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