Obtaining GPT fdisk

by Rod Smith, rodsmith@rodsbooks.com

Last Web page update: 4/18/2022, GPT fdisk version 1.0.9

This Web page, and the associated software, is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find GPT fdisk or this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!

Donate $1.00 Donate $2.50 Donate $5.00 Donate $10.00 Donate $20.00 Donate another value
Donate with PayPal
Donate with PayPal
Donate with PayPal
Donate with PayPal
Donate with PayPal
Donate with PayPal

Note: This page is part of the documentation for my GPT fdisk program.

GPT fdisk is available via several methods:

I've split the GPT fdisk binaries into two packages because they serve such different needs and because I want to minimize the risk of a user who wants FixParts accidentally converting a disk from MBR to GPT form by inappropriately using gdisk. I've kept the source code for all the programs together because it's all so related — except for one small source code file, all of the FixParts source files are used by gdisk.

Downloading GPT fdisk from SourceForge

The files section of the GPT fdisk SourceForge page has subdirectories for each GPT fdisk version. Beginning with version 0.7.0, these subdirectories are further subdivided. For version 1.0.9, these subdirectories are:

Building a Source RPM (or Debian Package)

If you download the source RPM, you can build the software and install it on any RPM-based distribution, or on Debian-based distributions with a bit more effort. You will need to install several packages. I recommend you launch Synaptic, Yumex, YaST2, or any other GUI package manager your distribution uses. Look for packages called gcc-c++, e2fsprogs-devel, libicu-devel, and popt-devel, and install them. Unfortunately, the package names vary from one distribution to another; for instance, some use -dev rather than -devel as part of the name, and sometimes the development files (normally in the -devel or -dev package) are included in the main package (such as in popt instead of popt-devel). You may also find you'll need to install other packages, such as libstdc++-devel. On Debian-based distributions, the build-essential package should pull in these common packages.

On an RPM-based distribution (such as Fedora, CentOS, or OpenSUSE), you may need to install a package called rpmbuild. On a Debian-based distribution (such as Debian or Ubuntu), you may need to install alien, which will also cause several RPM-related packages to be installed. Once you've installed all of these packages and downloaded the source RPM file, you can issue the following command to build the software:

$ rpmbuild --rebuild gptfdisk-1.0.9-1.src.rpm

A successful build will end with a line reading + exit 0. The result is two new binary package files, usually in /usr/src/rpm/RPMS/arch/ or ~/rpmbuild/RPMS/arch/, where arch is an architecture code for your system. If you can't find the files, look for the location on a line beginning with Wrote: about a dozen lines up from the end of the rpmbuild output. Once you've found these files, you can install them from that location or copy them somewhere convenient and install them from there.

If the build fails, chances are you're missing a development package. Examine the output, and find the first error message. Chances are there will be a report of a missing file a line or two above that, as in:

g++  -Wall -D_FILE_OFFSET_BITS=64   -c -o sgdisk.o sgdisk.cc
sgdisk.cc:13:18: error: popt.h: No such file or directory
sgdisk.cc: In function 'int main(int, char**)':
sgdisk.cc:58: error: 'poptContext' was not declared in this scope

In this example, the popt.h file is missing. Use your package manager to locate any package with a similar name — you'd type popt into the package manager's search function. Install any likely-sounding development package and try again.

If you use a Debian-based distribution, such as Debian or Ubuntu, you must convert the RPM packages into Debian package form. You do this with the alien utility from the directory in which the RPM files reside:

# alien -k gdisk-1.0.9-1.x86_64.rpm
# alien -k fixparts-1.0.9-1.x86_64.rpm

Note that these commands must be run as root (Ubuntu users should add sudo to the start of each command). Change the architecture code (x86_64 in this example) as necessary for your system. The result should be .deb files that you can install using dpkg or by double-clicking the files' icons.

Downloading GPT fdisk from Distribution Repositories

GPT fdisk is included in most major Linux distributions' standard package repositories. I'm no longer keeping track of which distributions have GPT fdisk packages, since the list is so extensive and includes most major distributions. I do recommend you pay attention to versions, though; some distributions are very behind in their GPT fdisk versions. Assuming the version is reasonably recent, installing from a distribution's package is usually a very convenient way to get the software.

Using an Emergency Disk

Some Linux emergency disk systems ship with GPT fdisk, so you can use the program from these emergency systems even if you run an OS on which GPT fdisk doesn't compile. The last I checked, most of these do not yet include FixParts, although PartedMagic 6.2 does. Emergency discs that provide GPT fdisk include:

Some distributions' installation media can be used as emergency disks, too. The Ubuntu Desktop installation .iso file, for instance, provides an option called "Try Ubuntu" that launches an Ubuntu desktop environment. GPT fdisk is included in this environment.

As GPT fdisk is a set of text-mode programs, you'll need to launch a Terminal program or open a text-mode console to use it. Most emergency disks provide a link to a Terminal program in some obvious location. If you don't see anything promising, look for a search feature and type terminal into it; with any luck that will turn up a Terminal program.

Uninstalling GPT fdisk

In most cases, uninstalling GPT fdisk is done through a reversal of the methods used to install it. In particular, Linux package managers such as dpkg and rpm provide uninstall options. Consult the package manager's documentation for details. If you install GPT fdisk under Windows, you can uninstall it by deleting whatever files you copied.

For the benefit of Mac users, I'm providing uninstall-gdisk and uninstall-fixparts scripts with the gdisk and fixparts packages, respectively. Type uninstall-gdisk or uninstall-fixparts to uninstall the specified package. Behind the scenes, these scripts are also run by the package installers prior to writing files to disk. This ensures that you won't have two versions of GPT fdisk installed if you upgrade from 1.0.0 or earlier to 1.0.1 or later.

Go on to "Revisions"

Return to "GPT fdisk" main page

copyright © 2009–2022 by Roderick W. Smith

If you have problems with or comments about this web page, please e-mail me at rodsmith@rodsbooks.com. Thanks.

Return to my main web page.