GPT fdisk Tutorial

by Rod Smith, rodsmith@rodsbooks.com

Last Web page update: 7/6/2018, referencing GPT fdisk version 1.0.4

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

GPT fdisk (consisting of the gdisk , cgdisk , sgdisk , and fixparts programs) is a set of text-mode partitioning tools for Linux, FreeBSD, Mac OS X, and Windows. The gdisk , cgdisk , and sgdisk programs work on Globally Unique Identifier (GUID) Partition Table (GPT) disks, rather than on the older (and once more common) Master Boot Record (MBR) partition tables. The fixparts program repairs certain types of damage to MBR disks and enables changing partition types from primary to logical and vice-versa. You can learn more about fixparts on its dedicated Web page. If gdisk , cgdisk , and sgdisk sound interesting to you, then read on (or skip straight to the "Obtaining GPT fdisk" link if you don't need the GPT pep talk). If you don't know what a GPT is, be sure to read the first section!

FreeBSD users: The FreeBSD version of GPT fdisk can't normally save changes to your partition table if any partition from the disk is mounted. If you want to modify your FreeBSD boot disk, the safest way to do so is from an emergency system or from a dual boot to another OS. Alternatively, you can type sysctl kern.geom.debugflags=16 at a shell prompt to enable FreeBSD to write to active disks. This limitation is shared by at least some other FreeBSD partitioning tools, such as gpt and FreeBSD's fdisk . This limitation does not exist in the Linux, Mac OS X, or Windows versions of the software.

OS X 10.11 ("El Capitan") and later users: This version of OS X adds a feature called System Integrity Protection (SIP), or less formally, "rootless." This system blocks access to certain critical aspects of the OS and hardware by third-party programs, including GPT fdisk. Thus, GPT fdisk's capabilities are limited under OS X 10.11 or later unless SIP is disabled. Specifically, low-level access to the system disk is forbidden, so you cannot repartition it. Access to USB flash drives remains possible, though. Disabling SIP is covered on several Web sites, including here and here. My rEFInd boot manager can disable SIP, as described here. Alternatively, you can run GPT fdisk from a Linux emergency disk.

Windows users: Windows cannot boot from a GPT disk unless the computer uses Unified Extensible Firmware Interface (UEFI) firmware, and versions prior to Vista may not be able to read GPT disks at all. Since GPT fdisk automatically turns MBR disks into GPT disks, you should use GPT fdisk only if you're positive your system can handle them. The vast majority of computers sold with Windows 8 and later have UEFI firmware and so also use GPT. Consult Microsoft's GPT FAQ for more information on Windows GPT support. If you have a BIOS-based computer and desperately need to boot from a GPT disk, consult my BIOS to UEFI Transformation Web page.

Sections

Man Pages

The Linux man pages for all of the GPT fdisk programs are available here:

Using GPT fdisk on Any Computer

At least three Linux emergency systems ship with GPT fdisk. You can create a bootable CD-R, boot it, and use GPT fdisk (and many other useful Linux utilities) even on systems on which GPT fdisk doesn't compile. These tools are also very useful for Linux, FreeBSD, Mac OS X, Windows, and other systems when things go wrong or when performing certain types of offline maintenance.

The emergency disks I know of that include GPT fdisk are:

Note that GPT fdisk is a Linux text-mode tool, so you'll need to know at least a minimal amount about using a Linux text-mode shell. Many basic introductions are available on the Web. You'll need to learn only enough to do very basic tasks; I've got a GPT fdisk walkthrough that describes GPT fdisk itself. Depending on your rescue CD and how you launched it, you may find yourself at a text-mode shell when you first boot, or you may need to locate an item called "Terminal," "Shell," "xterm," or something similar to start your text-mode shell.

Additional Resources

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.