srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 1 | GPT fdisk (aka gdisk) |
| 2 | by Roderick W. Smith, rodsmith@rodsbooks.com |
| 3 | |
| 4 | Introduction |
| 5 | ------------ |
| 6 | |
| 7 | This software is intended as a (somewhat) fdisk-workalike program for |
| 8 | GPT-partitioned disks. Although libparted and programs that use it (GNU |
| 9 | Parted, gparted, etc.) provide the ability to handle GPT disks, they have |
| 10 | certain limitations that gdisk overcomes. Specific advantages of gdisk |
| 11 | include: |
| 12 | |
| 13 | * The ability to convert MBR-partitioned disks in-place to GPT format, |
| 14 | without losing data |
| 15 | |
srs5694 | 221e087 | 2009-08-29 15:00:31 -0400 | [diff] [blame] | 16 | * The ability to convert BSD disklabels in-place to create GPT |
| 17 | partitions, without losing data |
| 18 | |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 19 | * The ability to specify sector-exact partition sizes |
| 20 | |
| 21 | * More flexible specification of filesystem type code GUIDs, which |
| 22 | GNU Parted tends to corrupt (particularly for FAT partitions) |
| 23 | |
| 24 | * Clear identification of the number of unallocated sectors on a |
| 25 | disk |
| 26 | |
| 27 | * A user interface that's familiar to long-time users of Linux |
| 28 | fdisk |
| 29 | |
| 30 | * The MBR boot loader code is left alone (GNU Parted tends to |
| 31 | wipe it out with every change) |
| 32 | |
srs5694 | 221e087 | 2009-08-29 15:00:31 -0400 | [diff] [blame] | 33 | * The ability to create a hybrid MBR, which permits GPT-unaware |
| 34 | OSes to access up to three GPT partitions on the disk |
| 35 | |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 36 | Of course, gdisk isn't without its limitations. Most notably, it lacks the |
| 37 | filesystem awareness and filesystem-related features of GNU Parted. You |
| 38 | can't resize a partition's filesystem or create a partition with a |
| 39 | filesystem already in place with gdisk, for instance. There's no GUI |
| 40 | version of gdisk. |
| 41 | |
| 42 | Installing |
| 43 | ---------- |
| 44 | |
| 45 | To compile gdisk, you must have appropriate development tools installed, |
| 46 | most notably the GNU Compiler Collection (GCC) and its g++ compiler for |
srs5694 | ba00fed | 2010-01-12 18:18:36 -0500 | [diff] [blame^] | 47 | C++. The sgdisk program also requires the popt library and its development |
| 48 | files (headers). Most Linux distributions install popt by default, but you |
| 49 | may need to install a package called popt-dev, popt-devel, or something |
| 50 | similar to obtain the development libraries. Mac OS users can find a version |
| 51 | of popt for Mac OS from http://popt.darwinports.com; however, you'll first |
| 52 | need to install DarwinPorts (instructions exist on the preceding page). |
| 53 | Alternatively, you can compile gdisk alone, without sgdisk; gdisk doesn't |
| 54 | require popt. |
| 55 | |
| 56 | When all the necessary development tools and libraries are installed, you |
| 57 | can uncompress the package and type "make" at the command prompt in the |
| 58 | resulting directory. The result should be program files called gdisk and |
| 59 | sgdisk. Typing "make gdisk" or "make sgdisk" will compile only the requested |
| 60 | programs. You can use these programs in place or copy the files to a |
| 61 | suitable directory, such as /usr/local/sbin. You can copy the man pages |
| 62 | (gdisk.8 and sgdisk.8) to /usr/local/man/man8 to make them available. |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 63 | |
| 64 | Caveats |
| 65 | ------- |
| 66 | |
srs5694 | 5d58fe0 | 2010-01-03 20:57:08 -0500 | [diff] [blame] | 67 | THIS SOFTWARE IS BETA SOFTWARE! IF IT WIPES OUT YOUR HARD DISK OR EATS YOUR |
| 68 | CAT, DON'T BLAME ME! To date, I've tested the software on several USB flash |
| 69 | drives, a handful of PATA and SATA hard disks, and several virtual disks in |
| 70 | a QEMU environment. I believe all data-corruption bugs to be squashed, but |
| 71 | I know full well that the odds of my missing something are high. This is |
| 72 | particularly true for large drives; my only direct testing with such disks |
| 73 | is with virtual QEMU disks. I've received user reports of success with |
| 74 | RAID arrays over 2TiB in size, though. |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 75 | |
| 76 | My main development platform is a system running the 64-bit version of |
srs5694 | 2a9f5da | 2009-08-26 00:48:01 -0400 | [diff] [blame] | 77 | Ubuntu 8.04. I've also tested on 64-bit OpenSuSE, 32-bit Fedora 10, 32-bit |
srs5694 | 5d58fe0 | 2010-01-03 20:57:08 -0500 | [diff] [blame] | 78 | Fedora 11, 32-bit Ubuntu 6.10, 64-bit Ubunut 9.10, 64-bit Gentoo, 32-bit |
| 79 | PowerPC Debian Linux, 32-bit Intel-based Mac OS X 10.5 and 10.6, and 64-bit |
| 80 | FreeBSD 7.1. Problems relating to 64-bit integers on the 32-bit Linux have |
| 81 | been common during development and may crop up in the future. The Mac OS X, |
| 82 | FreeBSD, and big-endian (PowerPC) support are new. |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 83 | |
| 84 | Redistribution |
| 85 | -------------- |
| 86 | |
| 87 | This program is licensed under terms of the GNU GPL (see the file COPYING). |
| 88 | |
| 89 | Acknowledgements |
| 90 | ---------------- |
| 91 | |
| 92 | This code is mostly my own; however, I've used three functions from two |
| 93 | other GPLed programs: |
| 94 | |
| 95 | - The code used to generate CRCs is taken from the efone program by |
| 96 | Krzysztof Dabrowski and ElysiuM deeZine. (See the crc32.h and |
| 97 | crc32.cc source code files.) |
| 98 | |
| 99 | - A function to find the disk size is taken from Linux fdisk by |
| 100 | A. V. Le Blanc. |
| 101 | |
| 102 | Additional code contributors include: |
| 103 | |
| 104 | - Yves Blusseau (1otnwmz02@sneakemail.com) |
| 105 | |
srs5694 | 7f244ba | 2009-08-18 14:22:12 -0400 | [diff] [blame] | 106 | - David Hubbard (david.c.hubbard@gmail.com) |