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
|
Roderick W. Smith | 946866e | 2014-03-02 13:33:44 -0500 | [diff] [blame] | 10 | on a Windows system unless you fully understand what you're doing or are
|
| 11 | certain that your computer boots in EFI/UEFI mode! If you accidentally use
|
| 12 | GPT fdisk on a BIOS-mode boot disk, or perhaps even on a data disk, you may
|
| 13 | find recovery to be very difficult! Pre-installed Windows 8 and later
|
| 14 | systems almost always use GPT disks and boot in EFI/UEFI mode, but
|
| 15 | self-installed Windows 8 systems sometimes use BIOS mode. This caveat does
|
| 16 | not apply to FixParts, though; that tool works only on MBR disks.
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 17 | ***************************************************************************
|
| 18 |
|
| 19 | Read the main README file for general information on the program, and read
|
srs5694 | bf8950c | 2011-03-12 01:23:12 -0500 | [diff] [blame] | 20 | the gdisk.html or fixparts.html documents (the Linux man pages converted to
|
| 21 | HTML format) for detailed use information. My GPT fdisk Web page,
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 22 | http://www.rodsbooks.com/gdisk/, provides a more tutorial introduction to
|
srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 23 | the software. I originally wrote GPT fdisk on Linux, and some Linux- and
|
| 24 | Unix-centric language remains in the documentation.
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 25 |
|
| 26 | Windows Use Notes
|
| 27 | -----------------
|
| 28 |
|
| 29 | The Windows version of GPT fdisk was added with version 0.6.2 of the
|
| 30 | package. The Windows binary package includes the gdisk.exe interactive
|
| 31 | text-mode program file but no equivalent to the sgdisk program that's
|
| 32 | available with Linux, FreeBSD, and OS X builds. In theory, an sgdisk.exe
|
| 33 | for Windows could be built if the popt library were installed. I've not
|
| 34 | attempted to do this myself, though. If you care to try, check
|
| 35 | http://gnuwin32.sourceforge.net/packages/popt.htm for information on popt
|
| 36 | for Windows.
|
| 37 |
|
Roderick W. Smith | 946866e | 2014-03-02 13:33:44 -0500 | [diff] [blame] | 38 | Beginning with version 0.8.10, I'm distributing both 32-bit and 64-bit
|
| 39 | binaries, which include the strings "32" or "64" in their names. The 32-bit
|
| 40 | binaries work fine on most versions of Windows, but some 64-bit
|
| 41 | installations of Windows 8 lack 32-bit support libraries and so may need
|
| 42 | the 64-bit binaries.
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 43 |
|
Roderick W. Smith | 946866e | 2014-03-02 13:33:44 -0500 | [diff] [blame] | 44 | The FixParts program (fixparts32.exe and fixparts64.exe) is new with GPT
|
| 45 | fdisk 0.7.0. As described in the main README file, this program fixes
|
| 46 | certain partition table problems that can be created by buggy partitioning
|
| 47 | software. Windows seems to be unfazed by most such problems, but I've not
|
| 48 | done an extensive survey of Windows partitioning tools on this score.
|
| 49 |
|
| 50 | To install the programs, copy the gdisk32.exe and fixparts32.exe (or
|
| 51 | gdisk64.exe and fixparts64.exe) program files to any directory on your
|
| 52 | path, such as C:\Windows. Alternatively, you can change to the program's
|
| 53 | directory or type its complete path whenever you use it.
|
srs5694 | bf8950c | 2011-03-12 01:23:12 -0500 | [diff] [blame] | 54 |
|
| 55 | To use the programs, first launch a Command Prompt as the Administrator. To
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 56 | do 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
|
| 58 | won't be able to edit hard disk partition tables, although you will be able
|
| 59 | to edit raw disk image files.
|
| 60 |
|
| 61 | The program requires a hard disk identifier as an option. You can specify
|
| 62 | this in either of two forms. The first way is as a number followed by a
|
| 63 | colon, as in:
|
| 64 |
|
| 65 | gdisk 0:
|
| 66 |
|
| 67 | Disks are numbered starting from 0, so the preceding command launches gdisk
|
| 68 | on the first disk. The second way to specify a disk device is via a
|
| 69 | harder-to-remember name:
|
| 70 |
|
Roderick W. Smith | 946866e | 2014-03-02 13:33:44 -0500 | [diff] [blame] | 71 | gdisk32 \\.\physicaldrive0
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 72 |
|
| 73 | This command is equivalent to the earlier one -- it edits the partition
|
| 74 | table on the first physical disk. Change the number at the end of the
|
| 75 | device name to change the disk edited.
|
| 76 |
|
srs5694 | bf8950c | 2011-03-12 01:23:12 -0500 | [diff] [blame] | 77 | If you pass the "-l" option to gdisk.exe in addition to the disk
|
| 78 | identifier, the program displays the current partition table information
|
| 79 | and then exits. This use entails no risk to MBR disks, since the program
|
| 80 | never writes data back to the disk when used in this way.
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 81 |
|
| 82 | As noted above, editing the first disk with GPT fdisk is usually a Bad
|
| 83 | Idea. An exception would be if your system uses an Extensible Firmware
|
| 84 | Interface (EFI) and already boots from a GPT disk. It's safer to edit
|
| 85 | non-boot disks, which usually have numbers of 1 and above, but only if you
|
| 86 | run a version of Windows with GPT support. For more information on Windows'
|
| 87 | support of GPT, see Microsoft's Web page on the topic:
|
| 88 |
|
| 89 | http://www.microsoft.com/whdc/device/storage/GPT_FAQ.mspx
|
| 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
|
Roderick W. Smith | 946866e | 2014-03-02 13:33:44 -0500 | [diff] [blame] | 107 | 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.
|
srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 113 |
|
srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 114 | - 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
|
srs5694 | bf8950c | 2011-03-12 01:23:12 -0500 | [diff] [blame] | 119 | 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).
|
srs5694 | 08bb0da | 2010-02-19 17:19:55 -0500 | [diff] [blame] | 121 |
|
srs5694 | 699941e | 2011-03-21 21:33:57 -0400 | [diff] [blame] | 122 | - 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 |
|
| 125 | The MinGW compiler produces much larger executables than do the MS
|
| 126 | compilers. The resulting binaries seem to work equally well, but my testing
|
srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 127 | has been minimal.
|
| 128 |
|
| 129 | I've also attempted to compile the code with OpenWatcom 1.8, but this
|
| 130 | attempt failed, mostly because the compiler can't yet handle iostream
|
| 131 | output on standard C++ strings. OpenWatcom also seems to have incorrectly
|
| 132 | set the value of UINT32_MAX as if uint32_t values were 64-bit integers.
|
| 133 | 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] | 134 |
|
| 135 | If you modify GPT fdisk to get it to compile under another compiler, I
|
| 136 | welcome submission of patches.
|