LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   role of partition type (code) in fdisk (https://www.linuxquestions.org/questions/linux-newbie-8/role-of-partition-type-code-in-fdisk-4175556437/)

vincix 10-17-2015 01:44 PM

role of partition type (code) in fdisk
 
As the title says, I want to know the role played by the partition type in fdisk. For instance, you create a new partition, choose the size and so on, and then you choose the type. Then you exit and you format it. What's the point of choosing the partition type if you format it with mkfs.ext4? So you specify ext4 in the format command.

Keruskerfuerst 10-17-2015 01:58 PM

https://www.win.tue.nl/~aeb/partitio...n_types-1.html

vincix 10-17-2015 02:18 PM

Quote:

Originally Posted by Keruskerfuerst (Post 5436054)

Not surprising that you are horridly unhelpful, as you haven't read my post correctly. I'll wait for someone nicer :)

astrogeek 10-17-2015 03:22 PM

The partition type, also called the partition ID, is just a byte, the eighth, in a partition table entry.

From here:

Quote:

The partition type (or partition ID) in a partition's entry in the partition table inside a Master Boot Record (MBR) is a byte value intended to specify the file system the partition contains and/or to flag special access methods used to access these partitions...

It is up to an operating system's boot loader and/or kernel how to interpret the value. So the table specifies which operating systems or disk-related products originally introduced an ID and what file system or special partition type they mapped it to. Partitions with partition types unknown to the software should be treated as reserved but occupied disk storage space, which should not be dealt with by the software, except for in FDISK-like tools.
The fdisk utility allows you to set an initial value for this byte, even though the partition itself has not yet been formatted (if applicable).

When you subsequently format the partition, for example with mke2fs, the value is reset - possibly to something different than had been specified with fdisk.

As stated in the above quoted snippet, it can represent something other than the filesystem type. For example, this is where a partition is identified as an extended type, which allows it to serve as a container for logical partitions, each of which may be of different filesystem types.

So to answer your question, I think, fdisk allows you to choose an initial value for this byte in the partition table which may identify it as an extended or other special access type, or may indicate the intended filesystem type which will only actually exist after subsequent formatting.

One use of this is for installers to identify target partitions for option selection such as swap, root and existing window$ partitions when installing a bootloader, or when specifying unformatted partitions for use.

vincix 10-18-2015 01:06 AM

Thank you for your ample answer.


All times are GMT -5. The time now is 08:34 PM.