srs5694 | bf8950c | 2011-03-12 01:23:12 -0500 | [diff] [blame] | 1 | GPT fdisk (aka gdisk) and FixParts
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 2 |
|
| 3 | by Roderick W. Smith, rodsmith@rodsbooks.com
|
| 4 |
|
| 5 | ******************************** IMPORTANT ********************************
|
srs5694 | bf8950c | 2011-03-12 01:23:12 -0500 | [diff] [blame] | 6 | Most versions of Windows cannot boot from a GPT disk on BIOS-based
|
| 7 | computers, and most varieties prior to Vista cannot read GPT disks. GPT
|
| 8 | fdisk is a partition editor for GPT disks, and it will *AUTOMATICALLY
|
| 9 | CONVERT* MBR disks to GPT form. Therefore, you should **NOT** use GPT fdisk
|
| 10 | on a Windows system unless you fully understand what you're doing! If you
|
| 11 | accidentally use GPT fdisk on your boot disk, or perhaps even on a data
|
| 12 | disk, you may find recovery to be very difficult! This caveat does not
|
| 13 | apply to FixParts, though; that tool works only on MBR disks.
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 14 | ***************************************************************************
|
| 15 |
|
| 16 | Read the main README file for general information on the program, and read
|
srs5694 | bf8950c | 2011-03-12 01:23:12 -0500 | [diff] [blame] | 17 | the gdisk.html or fixparts.html documents (the Linux man pages converted to
|
| 18 | HTML format) for detailed use information. My GPT fdisk Web page,
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 19 | http://www.rodsbooks.com/gdisk/, provides a more tutorial introduction to
|
srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 20 | the software. I originally wrote GPT fdisk on Linux, and some Linux- and
|
| 21 | Unix-centric language remains in the documentation.
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 22 |
|
| 23 | Windows Use Notes
|
| 24 | -----------------
|
| 25 |
|
| 26 | The Windows version of GPT fdisk was added with version 0.6.2 of the
|
| 27 | package. The Windows binary package includes the gdisk.exe interactive
|
| 28 | text-mode program file but no equivalent to the sgdisk program that's
|
| 29 | available with Linux, FreeBSD, and OS X builds. In theory, an sgdisk.exe
|
| 30 | for Windows could be built if the popt library were installed. I've not
|
| 31 | attempted to do this myself, though. If you care to try, check
|
| 32 | http://gnuwin32.sourceforge.net/packages/popt.htm for information on popt
|
| 33 | for Windows.
|
| 34 |
|
srs5694 | bf8950c | 2011-03-12 01:23:12 -0500 | [diff] [blame] | 35 | The FixParts program (fixparts.txt) is new with GPT fdisk 0.7.0. As
|
| 36 | described in the main README file, this program fixes certain partition
|
| 37 | table problems that can be created by buggy partitioning software. Windows
|
| 38 | seems to be unfazed by most such problems, but I've not done an extensive
|
| 39 | survey of Windows partitioning tools on this score.
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 40 |
|
srs5694 | bf8950c | 2011-03-12 01:23:12 -0500 | [diff] [blame] | 41 | To install the programs, copy the gdisk.exe and fixparts.exe program files
|
| 42 | to any directory on your path, such as C:\Windows. Alternatively, you can
|
| 43 | change to the program's directory or type its complete path whenever you
|
| 44 | use it.
|
| 45 |
|
| 46 | To use the programs, first launch a Command Prompt as the Administrator. To
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 47 | do 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
|
| 49 | won't be able to edit hard disk partition tables, although you will be able
|
| 50 | to edit raw disk image files.
|
| 51 |
|
| 52 | The program requires a hard disk identifier as an option. You can specify
|
| 53 | this in either of two forms. The first way is as a number followed by a
|
| 54 | colon, as in:
|
| 55 |
|
| 56 | gdisk 0:
|
| 57 |
|
| 58 | Disks are numbered starting from 0, so the preceding command launches gdisk
|
| 59 | on the first disk. The second way to specify a disk device is via a
|
| 60 | harder-to-remember name:
|
| 61 |
|
| 62 | gdisk \\.\physicaldrive0
|
| 63 |
|
| 64 | This command is equivalent to the earlier one -- it edits the partition
|
| 65 | table on the first physical disk. Change the number at the end of the
|
| 66 | device name to change the disk edited.
|
| 67 |
|
srs5694 | bf8950c | 2011-03-12 01:23:12 -0500 | [diff] [blame] | 68 | If you pass the "-l" option to gdisk.exe in addition to the disk
|
| 69 | identifier, the program displays the current partition table information
|
| 70 | and then exits. This use entails no risk to MBR disks, since the program
|
| 71 | never writes data back to the disk when used in this way.
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 72 |
|
| 73 | As noted above, editing the first disk with GPT fdisk is usually a Bad
|
| 74 | Idea. An exception would be if your system uses an Extensible Firmware
|
| 75 | Interface (EFI) and already boots from a GPT disk. It's safer to edit
|
| 76 | non-boot disks, which usually have numbers of 1 and above, but only if you
|
| 77 | run a version of Windows with GPT support. For more information on Windows'
|
| 78 | support of GPT, see Microsoft's Web page on the topic:
|
| 79 |
|
| 80 | http://www.microsoft.com/whdc/device/storage/GPT_FAQ.mspx
|
| 81 |
|
srs5694 | bf8950c | 2011-03-12 01:23:12 -0500 | [diff] [blame] | 82 | The GUIDs generated by gdisk to uniquely identify disks and partitions
|
| 83 | aren't "proper" GUIDs; they're purely random numbers. In practice, this has
|
| 84 | caused me no problems; however, it's conceivable that some disk utility
|
| 85 | will complain. The Unix versions of GPT fdisk generate proper GUIDs, as of
|
| 86 | version 0.6.3. Note that this limitation applies ONLY to the unique GUIDs
|
| 87 | for disks and partitions, not to the GUIDs used to identify partition type
|
| 88 | codes; those are standardized and are handled correctly by all versions of
|
| 89 | GPT fdisk.
|
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 90 |
|
srs5694 | 699941e | 2011-03-21 21:33:57 -0400 | [diff] [blame] | 91 | The Windows binaries I've compiled do not support Unicode UTF-16LE GPT
|
| 92 | partition names. This feature was added to version 0.7.1 of the software
|
| 93 | for Linux, FreeBSD, and OS X, and with changes to some #ifndef lines in the
|
| 94 | source files, it can be compiled for Windows; however, it seems to do
|
| 95 | little good in Windows because of Command Prompt window and/or ICU library
|
| 96 | limitations. Thus, I've omitted this support in the interests of
|
| 97 | simplifying the binary distribution, since including it would mean
|
| 98 | distributing the ICU libraries.
|
| 99 |
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 100 | Source Code and Compilation Issues
|
| 101 | ----------------------------------
|
| 102 |
|
srs5694 | 699941e | 2011-03-21 21:33:57 -0400 | [diff] [blame] | 103 | I have successfully compiled GPT fdisk using three different Windows
|
srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 104 | compilers:
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 105 |
|
srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 106 | - 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.
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 112 |
|
srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 113 | - 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
|
srs5694 | bf8950c | 2011-03-12 01:23:12 -0500 | [diff] [blame] | 118 | 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).
|
srs5694 | 08bb0da | 2010-02-19 17:19:55 -0500 | [diff] [blame] | 120 |
|
srs5694 | 699941e | 2011-03-21 21:33:57 -0400 | [diff] [blame] | 121 | - 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 |
|
| 124 | The MinGW compiler produces much larger executables than do the MS
|
| 125 | compilers. The resulting binaries seem to work equally well, but my testing
|
srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 126 | has been minimal.
|
| 127 |
|
| 128 | I've also attempted to compile the code with OpenWatcom 1.8, but this
|
| 129 | attempt failed, mostly because the compiler can't yet handle iostream
|
| 130 | output on standard C++ strings. OpenWatcom also seems to have incorrectly
|
| 131 | set the value of UINT32_MAX as if uint32_t values were 64-bit integers.
|
| 132 | This alone won't cause the compile to fail, but it would create bugs.
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 133 |
|
| 134 | If you modify GPT fdisk to get it to compile under another compiler, I
|
| 135 | welcome submission of patches.
|