blob: fa57484ae593588be10008e8e2d5cdbabc1ef3b9 [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
srs569491544e12010-01-28 21:10:36 -050091Source Code and Compilation Issues
92----------------------------------
93
srs569455d92612010-03-07 22:16:07 -050094I have successfully compiled GPT fdisk using two different Windows
95compilers:
srs569491544e12010-01-28 21:10:36 -050096
srs569455d92612010-03-07 22:16:07 -050097- MinGW (http://www.mingw.org), and in particular its Linux-hosted
98 cross-compiler -- Under Fedora Linux, the Makefile.mingw file enables
99 compilation of the software via MinGW. (Type "make -f Makefile.mingw" to
100 compile the software.) If you try to compile using another compiler or
101 even using MinGW under Windows or another Linux variety, you may need to
102 adjust the Makefile.mingw options.
srs569491544e12010-01-28 21:10:36 -0500103
srs569455d92612010-03-07 22:16:07 -0500104- Microsoft Visual C++ 2008 Express
105 (http://www.microsoft.com/express/Windows/) -- This compiler requires a
106 third-party stdint.h file (I used the one from
107 http://msinttypes.googlecode.com/svn/trunk/stdint.h), but it otherwise
108 works fine. A project is easily created by adding all the *.h files and
srs5694bf8950c2011-03-12 01:23:12 -0500109 all the *.cc files except diskio-unix.cc, sgdisk.cc, and whichever
110 program file you intend to NOT build (gdisk.cc or fixparts.cc).
srs569408bb0da2010-02-19 17:19:55 -0500111
srs569455d92612010-03-07 22:16:07 -0500112The MinGW compiler produces much larger executables than does the MS
113compiler. The resulting binaries seem to work equally well, but my testing
114has been minimal.
115
116I've also attempted to compile the code with OpenWatcom 1.8, but this
117attempt failed, mostly because the compiler can't yet handle iostream
118output on standard C++ strings. OpenWatcom also seems to have incorrectly
119set the value of UINT32_MAX as if uint32_t values were 64-bit integers.
120This alone won't cause the compile to fail, but it would create bugs.
srs569491544e12010-01-28 21:10:36 -0500121
122If you modify GPT fdisk to get it to compile under another compiler, I
123welcome submission of patches.