blob: 3194838696796125494fd05bc8fa274383e59fbf [file] [log] [blame]
srs5694bf8950c2011-03-12 01:23:12 -05001GPT fdisk (aka gdisk) and FixParts
srs569491544e12010-01-28 21:10:36 -05002
3by Roderick W. Smith, rodsmith@rodsbooks.com
4
5******************************** IMPORTANT ********************************
srs5694bf8950c2011-03-12 01:23:12 -05006Most versions of Windows cannot boot from a GPT disk on BIOS-based
7computers, and most varieties prior to Vista cannot read GPT disks. GPT
8fdisk is a partition editor for GPT disks, and it will *AUTOMATICALLY
9CONVERT* MBR disks to GPT form. Therefore, you should **NOT** use GPT fdisk
10on a Windows system unless you fully understand what you're doing! If you
11accidentally use GPT fdisk on your boot disk, or perhaps even on a data
12disk, you may find recovery to be very difficult! This caveat does not
13apply to FixParts, though; that tool works only on MBR disks.
srs569491544e12010-01-28 21:10:36 -050014***************************************************************************
15
16Read the main README file for general information on the program, and read
srs5694bf8950c2011-03-12 01:23:12 -050017the gdisk.html or fixparts.html documents (the Linux man pages converted to
18HTML format) for detailed use information. My GPT fdisk Web page,
srs569491544e12010-01-28 21:10:36 -050019http://www.rodsbooks.com/gdisk/, provides a more tutorial introduction to
srs569455d92612010-03-07 22:16:07 -050020the software. I originally wrote GPT fdisk on Linux, and some Linux- and
21Unix-centric language remains in the documentation.
srs569491544e12010-01-28 21:10:36 -050022
23Windows Use Notes
24-----------------
25
26The Windows version of GPT fdisk was added with version 0.6.2 of the
27package. The Windows binary package includes the gdisk.exe interactive
28text-mode program file but no equivalent to the sgdisk program that's
29available with Linux, FreeBSD, and OS X builds. In theory, an sgdisk.exe
30for Windows could be built if the popt library were installed. I've not
31attempted to do this myself, though. If you care to try, check
32http://gnuwin32.sourceforge.net/packages/popt.htm for information on popt
33for Windows.
34
srs5694bf8950c2011-03-12 01:23:12 -050035The FixParts program (fixparts.txt) is new with GPT fdisk 0.7.0. As
36described in the main README file, this program fixes certain partition
37table problems that can be created by buggy partitioning software. Windows
38seems to be unfazed by most such problems, but I've not done an extensive
39survey of Windows partitioning tools on this score.
srs569491544e12010-01-28 21:10:36 -050040
srs5694bf8950c2011-03-12 01:23:12 -050041To install the programs, copy the gdisk.exe and fixparts.exe program files
42to any directory on your path, such as C:\Windows. Alternatively, you can
43change to the program's directory or type its complete path whenever you
44use it.
45
46To use the programs, first launch a Command Prompt as the Administrator. To
srs569491544e12010-01-28 21:10:36 -050047do this, locate the Command Prompt program icon, right-click it, and select
48"Run as Administrator." If you use a non-Administrator Command Prompt, you
49won't be able to edit hard disk partition tables, although you will be able
50to edit raw disk image files.
51
52The program requires a hard disk identifier as an option. You can specify
53this in either of two forms. The first way is as a number followed by a
54colon, as in:
55
56gdisk 0:
57
58Disks are numbered starting from 0, so the preceding command launches gdisk
59on the first disk. The second way to specify a disk device is via a
60harder-to-remember name:
61
62gdisk \\.\physicaldrive0
63
64This command is equivalent to the earlier one -- it edits the partition
65table on the first physical disk. Change the number at the end of the
66device name to change the disk edited.
67
srs5694bf8950c2011-03-12 01:23:12 -050068If you pass the "-l" option to gdisk.exe in addition to the disk
69identifier, the program displays the current partition table information
70and then exits. This use entails no risk to MBR disks, since the program
71never writes data back to the disk when used in this way.
srs569491544e12010-01-28 21:10:36 -050072
73As noted above, editing the first disk with GPT fdisk is usually a Bad
74Idea. An exception would be if your system uses an Extensible Firmware
75Interface (EFI) and already boots from a GPT disk. It's safer to edit
76non-boot disks, which usually have numbers of 1 and above, but only if you
77run a version of Windows with GPT support. For more information on Windows'
78support of GPT, see Microsoft's Web page on the topic:
79
80http://www.microsoft.com/whdc/device/storage/GPT_FAQ.mspx
81
srs5694bf8950c2011-03-12 01:23:12 -050082The GUIDs generated by gdisk to uniquely identify disks and partitions
83aren't "proper" GUIDs; they're purely random numbers. In practice, this has
84caused me no problems; however, it's conceivable that some disk utility
85will complain. The Unix versions of GPT fdisk generate proper GUIDs, as of
86version 0.6.3. Note that this limitation applies ONLY to the unique GUIDs
87for disks and partitions, not to the GUIDs used to identify partition type
88codes; those are standardized and are handled correctly by all versions of
89GPT fdisk.
srs56946699b012010-02-04 00:55:30 -050090
srs5694699941e2011-03-21 21:33:57 -040091The Windows binaries I've compiled do not support Unicode UTF-16LE GPT
92partition names. This feature was added to version 0.7.1 of the software
93for Linux, FreeBSD, and OS X, and with changes to some #ifndef lines in the
94source files, it can be compiled for Windows; however, it seems to do
95little good in Windows because of Command Prompt window and/or ICU library
96limitations. Thus, I've omitted this support in the interests of
97simplifying the binary distribution, since including it would mean
98distributing the ICU libraries.
99
srs569491544e12010-01-28 21:10:36 -0500100Source Code and Compilation Issues
101----------------------------------
102
srs5694699941e2011-03-21 21:33:57 -0400103I have successfully compiled GPT fdisk using three different Windows
srs569455d92612010-03-07 22:16:07 -0500104compilers:
srs569491544e12010-01-28 21:10:36 -0500105
srs569455d92612010-03-07 22:16:07 -0500106- MinGW (http://www.mingw.org), and in particular its Linux-hosted
107 cross-compiler -- Under Fedora Linux, the Makefile.mingw file enables
108 compilation of the software via MinGW. (Type "make -f Makefile.mingw" to
109 compile the software.) If you try to compile using another compiler or
110 even using MinGW under Windows or another Linux variety, you may need to
111 adjust the Makefile.mingw options.
srs569491544e12010-01-28 21:10:36 -0500112
srs569455d92612010-03-07 22:16:07 -0500113- Microsoft Visual C++ 2008 Express
114 (http://www.microsoft.com/express/Windows/) -- This compiler requires a
115 third-party stdint.h file (I used the one from
116 http://msinttypes.googlecode.com/svn/trunk/stdint.h), but it otherwise
117 works fine. A project is easily created by adding all the *.h files and
srs5694bf8950c2011-03-12 01:23:12 -0500118 all the *.cc files except diskio-unix.cc, sgdisk.cc, and whichever
119 program file you intend to NOT build (gdisk.cc or fixparts.cc).
srs569408bb0da2010-02-19 17:19:55 -0500120
srs5694699941e2011-03-21 21:33:57 -0400121- Microsoft Visual C++ 2010 Express -- This compiler works much like the
122 2008 version, although I didn't need to add a third-party stdint.h file.
123
124The MinGW compiler produces much larger executables than do the MS
125compilers. The resulting binaries seem to work equally well, but my testing
srs569455d92612010-03-07 22:16:07 -0500126has been minimal.
127
128I've also attempted to compile the code with OpenWatcom 1.8, but this
129attempt failed, mostly because the compiler can't yet handle iostream
130output on standard C++ strings. OpenWatcom also seems to have incorrectly
131set the value of UINT32_MAX as if uint32_t values were 64-bit integers.
132This alone won't cause the compile to fail, but it would create bugs.
srs569491544e12010-01-28 21:10:36 -0500133
134If you modify GPT fdisk to get it to compile under another compiler, I
135welcome submission of patches.