Is there any command to list all partition type codes recognizable by currently installed
distribution (In my case Ubuntu 18.04.03 LTS)

I know the following website exists Andries E. Brouwer 1995-2002 - homepages.cwi.nl
yet there should be any command inbuilt in the linux console.

I know that cgdisk shows all partition codes while creating new partition

The screenshot1 is provided from my own system

The screenshot2 is provided from my own system

Provided screenshots from my own system while formatting a pendrive creating bootable Ubuntu 20.04 lts usb

Yet again my question is, Is there any command that can show all recognizable partition
type codes for MBR and GPT for the current distribution or if there is any
man pages that has reference?

Or may be this is different for the different tools?

Example of MBR partition types codes thestarman.pcministry.com

  • 1
    Could you clarify what you mean by “supported”? Linux distributions don’t care about partition types. Jul 22 '20 at 15:02
  • Also DEB and RPM distros contain pretty much the same utilities. There's zero difference in fdisk/sfdisk/gdisk/cfdisk/etc. between e.g. Fedora and Ubuntu. Jul 22 '20 at 15:11
  • Actually there is minor difference between fdisk/sfdisk/gdisk/cfdisk some doesn't show the list of partition types like the cgdisk from what I know. The thing is that I can't get list of all partition codes like MS partition is 0700 or 8300 for Linux. I can check the partition types and codes list in the mentioned website homepages.cwi.nl/~aeb/linux/disk/partition_types-1.html but for example if I want to list all /dev/sdb or sda or sd whatever without the loop devices in recent distributions like Ubuntu 18.04LTS or newer, I have those multiple loop devices.
    – Deus
    Jul 22 '20 at 16:00
  • So in order to list all /dev/sd* I found that lsblk -e7 will remove all loop devices from the output, but I should know that 7 stands for the loop device types. Now I'm interested in a way of listing all partition identifiers/types with the corresponding codes for those.
    – Deus
    Jul 22 '20 at 16:05
  • Just try lsblk and lsblk -e7 for yourself and you will get the point of my question if you also have all those loop devices in your distribution.
    – Deus
    Jul 22 '20 at 16:07

Ok finally I found that it's mainly dependent of the filesystem and the volume
identification hex code is/should be present in the filesystem documentation
as seen below for NTFS and EXT4

Conclusion: There is not specific command or tool only for listing partitions hex code besides the function of cgdisk, gdisk, cfdisk, fdisk, etc while creating the partition.

gdisk - list partition hex code previous to creation
cgdisk, cfdisk and fdisk - list partition hex code during creation only

NTFS Partition $VOLUME_INFORMATION 0x70 Attribute

EXT4 Partition Identifier for MBR (right column)

This post partially answers the question also
Why does parted need a filesystem type when creating a partition, and how does its action differ from a utility like mkfs.ext4?

"A partition can have a type. The partition type is a hint as in "this partition is designated to serve a certain function". Many partition types are associated with certain file-systems, though the association is not always strict or unambiguous. You can expect a partition of type 0x07 to have a Microsoft compatible file-system (e.g. FAT, NTFS or exFAT) and 0x83 to have a native Linux file-system (e.g. ext2/3/4)."

So apparently the code is not always strictly associated as shown in the previous answer.
For example EXT4 83h Any native Linux file system (see 93h, corresponds with 43h)

Or Solaris ZFS for example as seen in BFh and 82h sections

Additional examples information gathered during the research
ZFS Attributes BF01 BF07 EF02
BF01 special hex type code Solaris Partition
BF07 special hex type code Solaris Reserved 1
EF02 special hex type code BIOS Boot Partition

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.