TransWikia.com

Command to list partition type codes in deb and rpm distributions for MBR and GPT

Unix & Linux Asked by Deus on November 26, 2021

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

One Answer

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
http://dubeyko.com/development/FileSystems/NTFS/ntfsdoc.pdf


EXT4 Partition Identifier for MBR (right column)
https://en.wikipedia.org/wiki/Ext4


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)
https://en.wikipedia.org/wiki/Partition_type#PID_83h

Or Solaris ZFS for example as seen in BFh and 82h sections
https://en.wikipedia.org/wiki/Partition_type#PID_BFh
https://en.wikipedia.org/wiki/Partition_type#PID_82h

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
https://www.it-swarm-es.tech/es/gdisk/codigos-hex-de-gdisk/961390299/

Answered by Deus on November 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP