OnRod Smith's gdisk the Microsoft Basic Data partition type is shorthand code 0700 in the tool. gdisk shorthand codes are in hexadecimal, and are 16-bit integers rather than the underlying (128-bit) GUIDs used in the actual EFI partition table (which the tool maps the shorthands to, internally).
gdisk uses the convention of the old 8-bit MBR-style partition type multiplied by 0x0100 for its shorthand codes and is possibly easier to get to grips with in this respect with if one is coming from the MBR-style partition codes and DOS+Windows tools, as you apparently are.
I am running Ubuntu 15.10 and trying to format a USB drive to load a Windows ISO on. Every tutorial has you install ntfs-3g so that you can format to NTFS using fdisk, hex code 7. But when I go to fdisk and list the file system options, they are different than what is reported elsewhere:
The results from my fdisk file systems list is below. Is there something wrong with the USB drive that won't allow it to use the other file system types? Or am I missing some additional driver/software?
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!
A fourth tool, FixParts, is part of the GPTfdisk source package but is different enough that I distribute its binariesseparately. (Many Linux distributions package all four programs together ina package called gdisk, though.) This page documents use of thegdisk tool. Separate pages provide similar documentation forcgdisk and sgdisk, Acgdisk Walkthrough and Ansgdisk Walkthrough.
The GPT fdisk package includes a man page thatdocuments the gdisk program in the usual way. If you want to readup on all its options, please refer to that document. This page takes adifferent approach: It walks you through some common operations, explainingeach one.
You must launch gdisk with administrative privileges on allplatforms except when editing disk image files or, on some systems,removable disks. Under Linux, FreeBSD, or macOS, this is done by logging inas the root user, using su to acquire rootprivileges, or using the sudo utility. Under Windows, you canright-click the Command Prompt program and select the "Run asAdministrator" option, then use the resulting window to rungdisk.
You launch gdisk in much the same way as fdisk,although gdisk supports very few command-line arguments. (You maypass it the -l option to see the partition table and then quit,but that's it.) You must know the name of the device file that's used toaccess the disk. This varies from one OS to another:
In the Unix-style OSes, partition numbers are normally appended to the disk device filename, either directly (as in /dev/sda1 to refer to the first partition on /dev/sda) or with a p between the device filename and partition number, as in /dev/nvme0n1p2, to refer to the second partition on /dev/nvme0n1). Although GPT fdisk will not complain if it's launched on a partition device, this usage is almost always incorrect! You must normally partition the whole-disk device. The main time you'd partition a partition would be if the partition is being used as a virtual disk device for a computer virtualization tool, such as VMWare or VirtualBox.
This walkthrough uses as a starting point the partitioning of a 14.6 GiBUSB flash drive so that it contains three partitions: One FAT partition fordata exchange among multiple OSes, one ext4fs partition for use by Linuxalone, and one UFS partition for use by FreeBSD. This scenario isadmittedly somewhat artificial, since most people don't use USB flashdrives in this way; but this is similar to what you might do when settingup a hard disk for use by multiple OSes, or perhaps even one OS.
When gdisk starts, it performs a scan for four types ofexisting partition tables and displays the results. MBR is the commonMaster Boot Record partitioning system; BSD is the Berkeley StandardDistribution (BSD) disklabel system used on some computers that run a BSD(FreeBSD, OpenBSD, etc.); APM is the Apple Partition Map used on 680x0- andPowerPC-based Macintoshes; and GPT is of course the GUID Partition Table.The BSD and APM scans report either present or notpresent, but GPT can report three states (present, notpresent, or damaged), and there are four MBR states (MBRonly, protective, hybrid, or not present).The normal state for an MBR-only disk is as shown above, and the normalstate for a GPT disk is MBR: protective and GPT: present.Hybrid MBRs (described on my Hybrid MBRs page)change the MBR state to hybrid. Other combinations are possible,some of which indicate that a disk has been re-partitioned for a newpartitioning system without completely erasing the old partition table.
When starting gdisk on a disk with existing MBR or BSD disklabelpartitions and no GPT, the program displays a message surrounded byasterisks about converting the existing partitions to GPT, as just shown.This message is intended to scare you away if you launch gdisk onthe wrong disk by accident or if you don't know what you're doing.
This can happen when the final partition of an MBR disk runs right up to the end, overlapping the backup GPT partition table. As the warning says, you can either delete that partition or resize it in another utility before converting to GPT form. If you're following along to this tutorial with your own USB disk (that holds no data you care about), you can ignore this warning and delete the partition, as described shortly.
The Command (? for help): prompt is taken straight from Linuxfdisk, except that GPT fdisk uses ? as the promptfor help, whereas fdisk uses m. If you type?, you'll see a list of available commands:
fdisk users will recognize many of these commands, such asd, n, and p. Although some of these don't workin exactly the same way as in fdisk, most of them arevery similar. For instance, suppose you want to print the disk's partition table (p) to verify that you're workingon the disk you think you're working on and then delete the partition (d):
The Code column of the output shows the partition type code.Because GPT employs a 16-byte GUID number for storing partition type codes,displaying this raw code would be both space-consuming and difficult forpeople to parse. Thus, gdisk translates the GUID code into avariant of MBR type codes. In particular, the codes used by gdisk(when they're equivalent to MBR type codes) are the MBR codes multiplied byhexadecimal 0x0100, and displayed in hexadecimal. The 0x0700 code shownabove is therefore equivalent to an MBR code of 0x07, which is the code forHPFS/NTFS.
"But wait," you say, "I thought the disk had a FAT partition!" Indeed itdoes. On GPT disks, Windows uses a single GUID code for all its datapartitions, be they FAT or NTFS. In the past, the same code has been used inLinux for its data partitions. (More on this shortly....) Thus, in this caseseveral different MBR codes are all translated into a single GPT GUID code.GPT fdisk uses, somewhat arbitrarily, the 0x0700 code (or more precisely,EBD0A0A2-B9E5-4433-87C0-68B6B72699C7) for all of these.
The Name column displays a free-form text string that you canmodify. Starting with version 0.4.0, gdisk places the nameassociated with the partition type code in this field when it creates orconverts partitions, but you can change this default, as describedshortly. Note that GPT fdisk accesses the GPT data structure'sname for a partition. Most filesystems also support a name that's part ofthe filesystem's data structure. The two can match, but they don'thave to, and GPT fdisk makes no attempt to synchronize the two names.Confusingly, some partitioning tools, including GParted under Linux andboth Disk Utility and diskutil under macOS, display the filesystem name andhide the GPT name.
With the existence of this single partition as (presumably) sufficientidentification that this is the disk you want to modify, the dcommand deletes the partition. Since only one partition exists,gdisk doesn't prompt you for a number; it just responds Using1 and then displays another command prompt.
Partition locations and sizes can be entered in either absolute or fullyrelative form. In absolute form, you enter an absolute location or endpoint in sectors (or KiB, MiB, GiB, or TiB), as in 2048 forsector 2048 or 4M for the sector that corresponds to the4 MiB position on the disk. Relative values are specified by preceding thenumber with a plus sign (+) or minus sign (-), in whichcase the value is taken as relative to the start or end, respectively, ofthe free disk space area noted in the prompt. You can use this feature tocreate partitions with gaps between them, or to leave just enough spaceafter a partition to create another one of a given size. For instance, youcan specify +128M as the first sector to produce a 128MiBgap between the partition you're creating and the previous one; or you canspecify -1G as the last sector to fill all but 1GiB of thecontiguous free space.
The second partition, which will hold a Linux ext4 filesystem, receivesthe 0x8300 type code. Quite a few specialized Linux type codes have sprung up, most associated with the Discoverable Partitions Specification (DPS), which is intended to enable a Linux OS to figure out where to mount partitions even in the absence of an /etc/fstab file, which is the traditional way to handle this task. As of 2022, most distributions still create an /etc/fstab file and set the Linux filesystem type code (shown as 0x8300 in gdisk) on all Linux filesystem partitions. (LVM, swap, and some other partitions get their appropriate type codes.)
You can now tell by using the p command what the partition'spurpose is. (GNU Parted and many other tools also display partitions'names.) Partition names may theoretically contain any legal UTF-16character, at least on Linux, FreeBSD, and macOS. In practice, though, youmust have your locale set correctly and you must be using a font thatsupports the characters you plan to use. Windows is likely to garble non-ASCII names.
3a8082e126