Why do we need to specify partition type in fdisk and later again in mkfs

fdiskfilesystemspartition

I'm a little confused about fdisk and mkfs.

So – here is typical USB flash drive partitioning and formatting:

umount /dev/sdb
fdisk fdisk /dev/sdb

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-960, default 1): ↵
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-960, default 960): ↵
Using default value 960 

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 6
Changed system type of partition 1 to 6 (FAT16)

Command (m for help): a
Partition number (1-4): 1

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x 
partitions, please see the fdisk manual page for additional
information.

mkfs -t vfat /dev/sdb1

My question is:

Why do we even have to use t option to specify partition type while doing fdisk step? How does it affect everything? Does it create some mark on usb drive meaning that there only supposed to be vfat partition?
Or is it safe to skip t step altogether?
AFAIK – partitioning is only splitting disk into areas – is it not?

Just trying to understand why it works the way it works:)

Best Answer

Because mkfs does not know or care about partition tables. You can use it on any block device you wish, including those that have nothing to do with a hard disk, and therefore partitions. The partition type code that fdisk puts in the msdos partition table is only a hint and is pretty much ignored by non Microsoft operating systems.

Related Question