Skip to content
Snippets Groups Projects
user avatar
srs5694 authored
This version adds support for FreeBSD and big-endian systems. It also
adds support for BSD disklabels and an assortment of other changes,
improvements, and bug fixes.
221e0876
GPT fdisk (aka gdisk)
by Roderick W. Smith, rodsmith@rodsbooks.com

Introduction
------------

This software is intended as a (somewhat) fdisk-workalike program for
GPT-partitioned disks. Although libparted and programs that use it (GNU
Parted, gparted, etc.) provide the ability to handle GPT disks, they have
certain limitations that gdisk overcomes. Specific advantages of gdisk
include:

* The ability to convert MBR-partitioned disks in-place to GPT format,
  without losing data

* The ability to convert BSD disklabels in-place to create GPT
  partitions, without losing data

* The ability to specify sector-exact partition sizes

* More flexible specification of filesystem type code GUIDs, which
  GNU Parted tends to corrupt (particularly for FAT partitions)

* Clear identification of the number of unallocated sectors on a
  disk

* A user interface that's familiar to long-time users of Linux
  fdisk

* The MBR boot loader code is left alone (GNU Parted tends to
  wipe it out with every change)

* The ability to create a hybrid MBR, which permits GPT-unaware
  OSes to access up to three GPT partitions on the disk

Of course, gdisk isn't without its limitations. Most notably, it lacks the
filesystem awareness and filesystem-related features of GNU Parted. You
can't resize a partition's filesystem or create a partition with a
filesystem already in place with gdisk, for instance. There's no GUI
version of gdisk.

Installing
----------

To compile gdisk, you must have appropriate development tools installed,
most notably the GNU Compiler Collection (GCC) and its g++ compiler for
C++. Uncompress the package and type "make" at the command prompt in the
resulting directory. The result should be a program file called gdisk. You
can use this in place or copy the file to a suitable directory, such as
/usr/local/sbin. You can copy the man page (gdisk.8) to /usr/local/man/man8
to make it available.

Caveats
-------

THIS SOFTWARE IS EARLY BETA SOFTWARE! IF IT WIPES OUT YOUR HARD DISK OR
EATS YOUR CAT, DON'T BLAME ME! To date, I've tested the software mainly on
two USB flash drives, 2 GiB and 8 GiB in size. I've also made a few minor
tweaks to a production system with a 500 GiB hard disk and made more
extensive changes to a handful of 80-160 GiB hard disks. I believe all
data-corruption bugs to be squashed, but I know full well that the odds of
my missing something are high. This is particularly true for large drives;
I have no way of testing the software with > 2TiB drives, which will test
the 64-bit sector pointer support. I've received user reports of success
with >2TiB drives, though.

My main development platform is a system running the 64-bit version of
Ubuntu 8.04. I've also tested on 64-bit OpenSuSE, 32-bit Fedora 10, 32-bit
Ubuntu 6.10, 64-bit Gentoo, 32-bit PowerPC Linux, 32-bit Intel-based Mac
OS X, and 64-bit Fedora 7.1. Problems relating to 64-bit integers on the
32-bit Linux have been common during development and may crop up in the
future. The Mac OS X, FreeBSD, and big-endian (PowerPC) support are new.

Redistribution
--------------

This program is licensed under terms of the GNU GPL (see the file COPYING).

Acknowledgements
----------------

This code is mostly my own; however, I've used three functions from two
other GPLed programs:

- The code used to generate CRCs is taken from the efone program by
  Krzysztof Dabrowski and ElysiuM deeZine. (See the crc32.h and
  crc32.cc source code files.)

- A function to find the disk size is taken from Linux fdisk by
  A. V. Le Blanc.

Additional code contributors include:

- Yves Blusseau (1otnwmz02@sneakemail.com)

- David Hubbard (david.c.hubbard@gmail.com)