blob: 2a41fe3e1dbff621ba914842b850f88ed4e13864 [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
srs569455d92612010-03-07 22:16:07 -050072X or "make -f Makefile.mingw" to compile using MinGW for Windows.) You may
73also need to add header (include) directories or library directories by
74setting the CXXFLAGS environment variable or by editing the Makefile. The
srs56946699b012010-02-04 00:55:30 -050075result should be program files called gdisk and sgdisk. Typing "make gdisk"
76or "make sgdisk" will compile only the requested programs. You can use
77these programs in place or copy the files to a suitable directory, such as
78/usr/local/sbin. You can copy the man pages (gdisk.8 and sgdisk.8) to
79/usr/local/man/man8 to make them available.
srs5694e7b4ff92009-08-18 13:16:10 -040080
81Caveats
82-------
83
srs56945d58fe02010-01-03 20:57:08 -050084THIS SOFTWARE IS BETA SOFTWARE! IF IT WIPES OUT YOUR HARD DISK OR EATS YOUR
85CAT, DON'T BLAME ME! To date, I've tested the software on several USB flash
86drives, a handful of PATA and SATA hard disks, and several virtual disks in
87a QEMU environment. I believe all data-corruption bugs to be squashed, but
88I know full well that the odds of my missing something are high. This is
89particularly true for large drives; my only direct testing with such disks
90is with virtual QEMU disks. I've received user reports of success with
91RAID arrays over 2TiB in size, though.
srs5694e7b4ff92009-08-18 13:16:10 -040092
93My main development platform is a system running the 64-bit version of
srs569455d92612010-03-07 22:16:07 -050094Gentoo Linux (previously Ubuntu 8.04). I've also tested on 64-bit OpenSuSE,
9532-bit Fedora 10, 32-bit Fedora 11, 32-bit Ubuntu 6.10, 64-bit Ubunut 9.10,
9632-bit PowerPC Debian Linux, 32-bit Intel-based Mac OS X 10.5 and 10.6, and
9764-bit FreeBSD 7.1. Problems relating to 64-bit integers on the 32-bit
98Linux have been common during development and may crop up in the future.
99The Mac OS X, FreeBSD, and big-endian (PowerPC) support are new.
srs5694e7b4ff92009-08-18 13:16:10 -0400100
101Redistribution
102--------------
103
104This program is licensed under terms of the GNU GPL (see the file COPYING).
105
106Acknowledgements
107----------------
108
109This code is mostly my own; however, I've used three functions from two
110other GPLed programs:
111
112- The code used to generate CRCs is taken from the efone program by
113 Krzysztof Dabrowski and ElysiuM deeZine. (See the crc32.h and
114 crc32.cc source code files.)
115
116- A function to find the disk size is taken from Linux fdisk by
117 A. V. Le Blanc.
118
119Additional code contributors include:
120
121- Yves Blusseau (1otnwmz02@sneakemail.com)
122
srs56947f244ba2009-08-18 14:22:12 -0400123- David Hubbard (david.c.hubbard@gmail.com)