| srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 1 | GPT fdisk (aka gdisk) | 
|  | 2 |  | 
|  | 3 | by Roderick W. Smith, rodsmith@rodsbooks.com | 
|  | 4 |  | 
|  | 5 | ******************************** IMPORTANT ******************************** | 
|  | 6 | Most versions of Windows cannot boot from a GPT disk, and most varieties | 
|  | 7 | prior to Vista cannot read GPT disks. GPT fdisk is a partition editor for | 
|  | 8 | GPT disks, and it will *AUTOMATICALLY CONVERT* MBR disks to GPT form. | 
|  | 9 | Therefore, you should **NOT** use GPT fdisk on a Windows system unless you | 
|  | 10 | fully understand what you're doing! If you accidentally use GPT fdisk on | 
|  | 11 | your boot disk, or perhaps even on a data disk, you may find recovery to be | 
|  | 12 | very difficult! | 
|  | 13 | *************************************************************************** | 
|  | 14 |  | 
|  | 15 | Read the main README file for general information on the program, and read | 
|  | 16 | the gdisk.html document (the Linux man page converted to HTML format) for | 
|  | 17 | detailed use information. My GPT fdisk Web page, | 
|  | 18 | http://www.rodsbooks.com/gdisk/, provides a more tutorial introduction to | 
| srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 19 | the software. I originally wrote GPT fdisk on Linux, and some Linux- and | 
|  | 20 | Unix-centric language remains in the documentation. | 
| srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 21 |  | 
|  | 22 | Windows Use Notes | 
|  | 23 | ----------------- | 
|  | 24 |  | 
|  | 25 | The Windows version of GPT fdisk was added with version 0.6.2 of the | 
|  | 26 | package. The Windows binary package includes the gdisk.exe interactive | 
|  | 27 | text-mode program file but no equivalent to the sgdisk program that's | 
|  | 28 | available with Linux, FreeBSD, and OS X builds. In theory, an sgdisk.exe | 
|  | 29 | for Windows could be built if the popt library were installed. I've not | 
|  | 30 | attempted to do this myself, though. If you care to try, check | 
|  | 31 | http://gnuwin32.sourceforge.net/packages/popt.htm for information on popt | 
|  | 32 | for Windows. | 
|  | 33 |  | 
|  | 34 | To install the program, copy the gdisk.exe program file to any directory on | 
|  | 35 | your path, such as C:\Windows. Alternatively, you can change to the | 
|  | 36 | program's directory or type its complete path whenever you use it. | 
|  | 37 |  | 
|  | 38 | To use the program, first launch a Command Prompt as the Administrator. To | 
|  | 39 | do this, locate the Command Prompt program icon, right-click it, and select | 
|  | 40 | "Run as Administrator." If you use a non-Administrator Command Prompt, you | 
|  | 41 | won't be able to edit hard disk partition tables, although you will be able | 
|  | 42 | to edit raw disk image files. | 
|  | 43 |  | 
|  | 44 | The program requires a hard disk identifier as an option. You can specify | 
|  | 45 | this in either of two forms. The first way is as a number followed by a | 
|  | 46 | colon, as in: | 
|  | 47 |  | 
|  | 48 | gdisk 0: | 
|  | 49 |  | 
|  | 50 | Disks are numbered starting from 0, so the preceding command launches gdisk | 
|  | 51 | on the first disk. The second way to specify a disk device is via a | 
|  | 52 | harder-to-remember name: | 
|  | 53 |  | 
|  | 54 | gdisk \\.\physicaldrive0 | 
|  | 55 |  | 
|  | 56 | This command is equivalent to the earlier one -- it edits the partition | 
|  | 57 | table on the first physical disk. Change the number at the end of the | 
|  | 58 | device name to change the disk edited. | 
|  | 59 |  | 
|  | 60 | If you pass the "-l" option in addition to the disk identifier, the program | 
|  | 61 | displays the current partition table information and then exits. This use | 
|  | 62 | entails no risk to MBR disks, since the program never writes data back to | 
|  | 63 | the disk when used in this way. | 
|  | 64 |  | 
|  | 65 | As noted above, editing the first disk with GPT fdisk is usually a Bad | 
|  | 66 | Idea. An exception would be if your system uses an Extensible Firmware | 
|  | 67 | Interface (EFI) and already boots from a GPT disk. It's safer to edit | 
|  | 68 | non-boot disks, which usually have numbers of 1 and above, but only if you | 
|  | 69 | run a version of Windows with GPT support. For more information on Windows' | 
|  | 70 | support of GPT, see Microsoft's Web page on the topic: | 
|  | 71 |  | 
|  | 72 | http://www.microsoft.com/whdc/device/storage/GPT_FAQ.mspx | 
|  | 73 |  | 
| srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 74 | The GUIDs generated by the program to uniquely identify disks and | 
|  | 75 | partitions aren't "proper" GUIDs; they're purely random numbers. In | 
|  | 76 | practice, this has caused me no problems; however, it's conceivable that | 
|  | 77 | some disk utility will complain. The Unix versions of GPT fdisk generate | 
|  | 78 | proper GUIDs, as of version 0.6.3. Note that this limitation applies ONLY | 
|  | 79 | to the unique GUIDs for disks and partitions, not to the GUIDs used to | 
|  | 80 | identify partition type codes; those are standardized and are handled | 
|  | 81 | correctly by all versions of GPT fdisk. | 
|  | 82 |  | 
| srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 83 | Source Code and Compilation Issues | 
|  | 84 | ---------------------------------- | 
|  | 85 |  | 
| srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 86 | I have successfully compiled GPT fdisk using two different Windows | 
|  | 87 | compilers: | 
| srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 88 |  | 
| srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 89 | - MinGW (http://www.mingw.org), and in particular its Linux-hosted | 
|  | 90 | cross-compiler -- Under Fedora Linux, the Makefile.mingw file enables | 
|  | 91 | compilation of the software via MinGW. (Type "make -f Makefile.mingw" to | 
|  | 92 | compile the software.) If you try to compile using another compiler or | 
|  | 93 | even using MinGW under Windows or another Linux variety, you may need to | 
|  | 94 | adjust the Makefile.mingw options. | 
| srs5694 | 91544e1 | 2010-01-28 21:10:36 -0500 | [diff] [blame] | 95 |  | 
| srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 96 | - Microsoft Visual C++ 2008 Express | 
|  | 97 | (http://www.microsoft.com/express/Windows/) -- This compiler requires a | 
|  | 98 | third-party stdint.h file (I used the one from | 
|  | 99 | http://msinttypes.googlecode.com/svn/trunk/stdint.h), but it otherwise | 
|  | 100 | works fine. A project is easily created by adding all the *.h files and | 
|  | 101 | all the *.cc files except diskio-unix.cc and sgdisk.cc. | 
| srs5694 | 08bb0da | 2010-02-19 17:19:55 -0500 | [diff] [blame] | 102 |  | 
| srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 103 | The MinGW compiler produces much larger executables than does the MS | 
|  | 104 | compiler. The resulting binaries seem to work equally well, but my testing | 
|  | 105 | has been minimal. | 
|  | 106 |  | 
|  | 107 | I've also attempted to compile the code with OpenWatcom 1.8, but this | 
|  | 108 | attempt failed, mostly because the compiler can't yet handle iostream | 
|  | 109 | output on standard C++ strings. OpenWatcom also seems to have incorrectly | 
|  | 110 | set the value of UINT32_MAX as if uint32_t values were 64-bit integers. | 
|  | 111 | 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] | 112 |  | 
|  | 113 | If you modify GPT fdisk to get it to compile under another compiler, I | 
|  | 114 | welcome submission of patches. |