blob: bca2f0ed0d923f9215ff65e1e3da0886523cb56a [file] [log] [blame]
srs5694e7b4ff92009-08-18 13:16:10 -04001GPT fdisk (aka gdisk)
2by Roderick W. Smith, rodsmith@rodsbooks.com
3
4Introduction
5------------
6
7This software is intended as a (somewhat) fdisk-workalike program for
8GPT-partitioned disks. Although libparted and programs that use it (GNU
9Parted, gparted, etc.) provide the ability to handle GPT disks, they have
srs56943c0af382010-01-15 19:19:18 -050010certain limitations that gdisk overcomes. Specific advantages of gdisk and
11sgdisk include:
srs5694e7b4ff92009-08-18 13:16:10 -040012
13* The ability to convert MBR-partitioned disks in-place to GPT format,
14 without losing data
15
srs5694221e0872009-08-29 15:00:31 -040016* The ability to convert BSD disklabels in-place to create GPT
17 partitions, without losing data
18
srs5694e7b4ff92009-08-18 13:16:10 -040019* 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
srs56943c0af382010-01-15 19:19:18 -050028 fdisk (gdisk only)
srs5694e7b4ff92009-08-18 13:16:10 -040029
30* The MBR boot loader code is left alone (GNU Parted tends to
31 wipe it out with every change)
32
srs5694221e0872009-08-29 15:00:31 -040033* The ability to create a hybrid MBR, which permits GPT-unaware
34 OSes to access up to three GPT partitions on the disk
35
srs56943c0af382010-01-15 19:19:18 -050036Of course, GPT fdisk isn't without its limitations. Most notably, it lacks
37the filesystem awareness and filesystem-related features of GNU Parted. You
srs5694e7b4ff92009-08-18 13:16:10 -040038can't resize a partition's filesystem or create a partition with a
39filesystem already in place with gdisk, for instance. There's no GUI
40version of gdisk.
41
srs56943c0af382010-01-15 19:19:18 -050042The GPT fdisk package provides two program files: the interactive text-mode
43gdisk and the command-line-driven sgdisk. The former is intended for use in
44manually partitioning disks or changing partitioning details; the latter is
45intended for use in scripts to help automate tasks such as disk cloning or
46preparing multiple disks for Linux installation.
47
srs5694e7b4ff92009-08-18 13:16:10 -040048Installing
49----------
50
srs56943c0af382010-01-15 19:19:18 -050051To compile GPT fdisk, you must have appropriate development tools
52installed, most notably the GNU Compiler Collection (GCC) and its g++
srs56946699b012010-02-04 00:55:30 -050053compiler for C++. In addition, note these requirements:
54
55* On Linux, FreeBSD, and OS X, libuuid must be installed. This is the
56 standard for Linux and OS X, although you may need to install a package
57 called uuid-dev or something similar to get the headers. On FreeBSD, the
58 e2fsprogs-libuuid port must be installed.
59
60* The sgdisk program also requires the popt library and its development
61 files (headers). Most Linux distributions install popt by default, but
62 you may need to install a package called popt-dev, popt-devel, or
63 something similar to obtain the header files. Mac OS users can find a
64 version of popt for Mac OS from http://popt.darwinports.com; however,
65 you'll first need to install DarwinPorts (instructions exist on the
66 preceding page). Alternatively, you can compile gdisk alone, without
67 sgdisk; gdisk doesn't require popt.
srs5694ba00fed2010-01-12 18:18:36 -050068
69When all the necessary development tools and libraries are installed, you
70can uncompress the package and type "make" at the command prompt in the
srs56946699b012010-02-04 00:55:30 -050071resulting directory. (You may need to type "make -f Makefile.mac" on Mac OS
srs56949ba54212010-05-18 23:24:02 -040072X, "make -f Makefile.freebsd" on FreeBSD, or "make -f Makefile.mingw" to
73compile using MinGW for Windows.) You may also need to add header (include)
74directories or library directories by setting the CXXFLAGS environment
75variable or by editing the Makefile. The result should be program files
76called gdisk and sgdisk. Typing "make gdisk" or "make sgdisk" will compile
77only the requested programs. You can use these programs in place or copy
78the files to a suitable directory, such as /usr/local/sbin. You can copy
79the man pages (gdisk.8 and sgdisk.8) to /usr/local/man/man8 to make them
80available.
srs5694e7b4ff92009-08-18 13:16:10 -040081
82Caveats
83-------
84
srs56945d58fe02010-01-03 20:57:08 -050085THIS SOFTWARE IS BETA SOFTWARE! IF IT WIPES OUT YOUR HARD DISK OR EATS YOUR
86CAT, DON'T BLAME ME! To date, I've tested the software on several USB flash
87drives, a handful of PATA and SATA hard disks, and several virtual disks in
88a QEMU environment. I believe all data-corruption bugs to be squashed, but
89I know full well that the odds of my missing something are high. This is
90particularly true for large drives; my only direct testing with such disks
91is with virtual QEMU disks. I've received user reports of success with
92RAID arrays over 2TiB in size, though.
srs5694e7b4ff92009-08-18 13:16:10 -040093
94My main development platform is a system running the 64-bit version of
srs569455d92612010-03-07 22:16:07 -050095Gentoo Linux (previously Ubuntu 8.04). I've also tested on 64-bit OpenSuSE,
9632-bit Fedora 10, 32-bit Fedora 11, 32-bit Ubuntu 6.10, 64-bit Ubunut 9.10,
srs56949ba54212010-05-18 23:24:02 -04009732-bit PowerPC Debian Linux, 32-bit Intel-based Mac OS X 10.5 and 10.6,
9864-bit FreeBSD 7.1, and Windows 7. Problems relating to 64-bit integers on
99the 32-bit Linux have been common during development and may crop up in the
100future.
srs5694e7b4ff92009-08-18 13:16:10 -0400101
102Redistribution
103--------------
104
105This program is licensed under terms of the GNU GPL (see the file COPYING).
106
107Acknowledgements
108----------------
109
110This code is mostly my own; however, I've used three functions from two
111other GPLed programs:
112
113- The code used to generate CRCs is taken from the efone program by
114 Krzysztof Dabrowski and ElysiuM deeZine. (See the crc32.h and
115 crc32.cc source code files.)
116
srs56949ba54212010-05-18 23:24:02 -0400117- A function to find the disk size is taken from Linux fdisk by A. V. Le
118 Blanc. This code has subsequently been heavily modified.
srs5694e7b4ff92009-08-18 13:16:10 -0400119
120Additional code contributors include:
121
122- Yves Blusseau (1otnwmz02@sneakemail.com)
123
srs56947f244ba2009-08-18 14:22:12 -0400124- David Hubbard (david.c.hubbard@gmail.com)