When we partitioning a hard drive in Linux we set a System ID (for example 83) for a partition and when we want to mount it to a directory we use mkfs -t to format it and mount it to the directory. My question is why we don't format the partition when using fdisk command at first and we need to do it again?

  • It doesn't matter. 18.04 – fedora Jan 11 '19 at 11:42

fdisk only edits the partition table, not the file system. When you edit partitions, you are really editing the MBR (Master Boot Record) or GPT (GUID Partition Table) of the drive, and boot sectors of the partitions. The MBR/GPT contains the start and end sector boundaries for each partition (just the sector numbers where the partition starts and ends, not the actual partition space itself), and the type of partition it is (like type 83). fdisk doesn't contain the necessary logic to create file systems.

When you run mkfs, you are editing the file system within the start and end partition boundaries that were set by fdisk in the MBR/GPT. For example, it creates block groups which hold things like the inode table to map file fragments on the partition to the file path.

| improve this answer | |

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.