GPT partition type for ext4 filesystem

15,784

That error message has nothing to do with GPT (or MBR) type codes; it's referring to the filesystem contained within the partition. I suspect you haven't created that filesystem. Many partitioning tools, including gdisk, do not create filesystems; they just create the partitions in which filesystems can be created. To create a filesystem, you'd need to use a command like this:

mkfs -t ext4 /dev/sda4

You must type that command as root or via the sudo utility, just like gdisk.

Some tools, such as GParted, do both jobs simultaneously, which is convenient but muddies the waters a bit for those learning the system, because it's easy to misunderstand the distinction between partitions and filesystems. Partitions are simple data structures that consist of the starting sector number and the ending sector number (or, equivalently, the length), as well as associated meta-data such as a type code. Filesystems are much more complex data structures that are typically contained within a partition. Filesystems facilitate the creation and manipulation of files -- often thousands of them.

Incidentally, the Linux kernel ignores partition type codes. So do many Linux utilities. Linux partitioning tools support them because they're part of partition table data structures and because some other OSes use type codes as a filter, so it's important that the Linux codes be right in a dual-boot environment. Linux installation programs also often use type codes in a similar way.

Share:
15,784

Related videos on Youtube

NRJ
Author by

NRJ

Kinda Lazy

Updated on September 18, 2022

Comments

  • NRJ
    NRJ over 1 year

    My disk is formatted using GPT. I created a new partition and by default it was create as 'Linux filesystem' (gdisk code 8300).

    When I am trying to mount it via fstab

    /dev/sda4 /vmguests               ext4    errors=remount-ro 0       1
    

    it errors out with

    mount: wrong fs type, bad option, bad superblock on /dev/sda4
    

    What would be the right type code for ext4 filesystem in gdisk?