blob: 3f49023cfa51ef859732ac47b2d9b6b50fb6a33c [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
Roderick W. Smith946866e2014-03-02 13:33:44 -050010on a Windows system unless you fully understand what you're doing or are
11certain that your computer boots in EFI/UEFI mode! If you accidentally use
12GPT fdisk on a BIOS-mode boot disk, or perhaps even on a data disk, you may
13find recovery to be very difficult! Pre-installed Windows 8 and later
14systems almost always use GPT disks and boot in EFI/UEFI mode, but
15self-installed Windows 8 systems sometimes use BIOS mode. This caveat does
16not apply to FixParts, though; that tool works only on MBR disks.
srs569491544e12010-01-28 21:10:36 -050017***************************************************************************
18
19Read the main README file for general information on the program, and read
srs5694bf8950c2011-03-12 01:23:12 -050020the gdisk.html or fixparts.html documents (the Linux man pages converted to
21HTML format) for detailed use information. My GPT fdisk Web page,
srs569491544e12010-01-28 21:10:36 -050022http://www.rodsbooks.com/gdisk/, provides a more tutorial introduction to
srs569455d92612010-03-07 22:16:07 -050023the software. I originally wrote GPT fdisk on Linux, and some Linux- and
24Unix-centric language remains in the documentation.
srs569491544e12010-01-28 21:10:36 -050025
26Windows Use Notes
27-----------------
28
29The Windows version of GPT fdisk was added with version 0.6.2 of the
30package. The Windows binary package includes the gdisk.exe interactive
31text-mode program file but no equivalent to the sgdisk program that's
32available with Linux, FreeBSD, and OS X builds. In theory, an sgdisk.exe
33for Windows could be built if the popt library were installed. I've not
34attempted to do this myself, though. If you care to try, check
35http://gnuwin32.sourceforge.net/packages/popt.htm for information on popt
36for Windows.
37
Roderick W. Smith946866e2014-03-02 13:33:44 -050038Beginning with version 0.8.10, I'm distributing both 32-bit and 64-bit
39binaries, which include the strings "32" or "64" in their names. The 32-bit
40binaries work fine on most versions of Windows, but some 64-bit
41installations of Windows 8 lack 32-bit support libraries and so may need
42the 64-bit binaries.
srs569491544e12010-01-28 21:10:36 -050043
Roderick W. Smith946866e2014-03-02 13:33:44 -050044The FixParts program (fixparts32.exe and fixparts64.exe) is new with GPT
45fdisk 0.7.0. As described in the main README file, this program fixes
46certain partition table problems that can be created by buggy partitioning
47software. Windows seems to be unfazed by most such problems, but I've not
48done an extensive survey of Windows partitioning tools on this score.
49
50To install the programs, copy the gdisk32.exe and fixparts32.exe (or
51gdisk64.exe and fixparts64.exe) program files to any directory on your
52path, such as C:\Windows. Alternatively, you can change to the program's
53directory or type its complete path whenever you use it.
srs5694bf8950c2011-03-12 01:23:12 -050054
55To use the programs, first launch a Command Prompt as the Administrator. To
srs569491544e12010-01-28 21:10:36 -050056do this, locate the Command Prompt program icon, right-click it, and select
57"Run as Administrator." If you use a non-Administrator Command Prompt, you
58won't be able to edit hard disk partition tables, although you will be able
59to edit raw disk image files.
60
61The program requires a hard disk identifier as an option. You can specify
62this in either of two forms. The first way is as a number followed by a
63colon, as in:
64
65gdisk 0:
66
67Disks are numbered starting from 0, so the preceding command launches gdisk
68on the first disk. The second way to specify a disk device is via a
69harder-to-remember name:
70
Roderick W. Smith946866e2014-03-02 13:33:44 -050071gdisk32 \\.\physicaldrive0
srs569491544e12010-01-28 21:10:36 -050072
73This command is equivalent to the earlier one -- it edits the partition
74table on the first physical disk. Change the number at the end of the
75device name to change the disk edited.
76
srs5694bf8950c2011-03-12 01:23:12 -050077If you pass the "-l" option to gdisk.exe in addition to the disk
78identifier, the program displays the current partition table information
79and then exits. This use entails no risk to MBR disks, since the program
80never writes data back to the disk when used in this way.
srs569491544e12010-01-28 21:10:36 -050081
82As noted above, editing the first disk with GPT fdisk is usually a Bad
83Idea. An exception would be if your system uses an Extensible Firmware
84Interface (EFI) and already boots from a GPT disk. It's safer to edit
85non-boot disks, which usually have numbers of 1 and above, but only if you
86run a version of Windows with GPT support. For more information on Windows'
87support of GPT, see Microsoft's Web page on the topic:
88
89http://www.microsoft.com/whdc/device/storage/GPT_FAQ.mspx
90
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
Roderick W. Smith946866e2014-03-02 13:33:44 -0500107 cross-compiler -- Under Ubuntu Linux, the Makefile.mingw and
108 Makefile.mingw64 files enable compilation of the software via MinGW.
109 (Type "make -f Makefile.mingw" to compile 32-bit binaries, and "make -f
110 Makefile.mingw64" to compile 64-bit binaries.) If you try to compile
111 using another compiler or even using MinGW under Windows or another Linux
112 variety, you may need to adjust the Makefile.mingw options.
srs569491544e12010-01-28 21:10:36 -0500113
srs569455d92612010-03-07 22:16:07 -0500114- Microsoft Visual C++ 2008 Express
115 (http://www.microsoft.com/express/Windows/) -- This compiler requires a
116 third-party stdint.h file (I used the one from
117 http://msinttypes.googlecode.com/svn/trunk/stdint.h), but it otherwise
118 works fine. A project is easily created by adding all the *.h files and
srs5694bf8950c2011-03-12 01:23:12 -0500119 all the *.cc files except diskio-unix.cc, sgdisk.cc, and whichever
120 program file you intend to NOT build (gdisk.cc or fixparts.cc).
srs569408bb0da2010-02-19 17:19:55 -0500121
srs5694699941e2011-03-21 21:33:57 -0400122- Microsoft Visual C++ 2010 Express -- This compiler works much like the
123 2008 version, although I didn't need to add a third-party stdint.h file.
124
125The MinGW compiler produces much larger executables than do the MS
126compilers. The resulting binaries seem to work equally well, but my testing
srs569455d92612010-03-07 22:16:07 -0500127has been minimal.
128
129I've also attempted to compile the code with OpenWatcom 1.8, but this
130attempt failed, mostly because the compiler can't yet handle iostream
131output on standard C++ strings. OpenWatcom also seems to have incorrectly
132set the value of UINT32_MAX as if uint32_t values were 64-bit integers.
133This alone won't cause the compile to fail, but it would create bugs.
srs569491544e12010-01-28 21:10:36 -0500134
135If you modify GPT fdisk to get it to compile under another compiler, I
136welcome submission of patches.