Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-17-2015, 02:44 PM   #1
Registered: Feb 2011
Distribution: Centos 6.7, 7
Posts: 689

Rep: Reputation: 69
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.

Last edited by vincix; 10-18-2015 at 02:08 AM.
Old 10-17-2015, 02:58 PM   #2
Senior Member
Registered: Oct 2005
Distribution: SLES 12
Posts: 1,856

Rep: Reputation: 132Reputation: 132
Old 10-17-2015, 03:18 PM   #3
Registered: Feb 2011
Distribution: Centos 6.7, 7
Posts: 689

Original Poster
Rep: Reputation: 69
Originally Posted by Keruskerfuerst View Post
Not surprising that you are horridly unhelpful, as you haven't read my post correctly. I'll wait for someone nicer

Last edited by vincix; 10-17-2015 at 03:26 PM.
Old 10-17-2015, 04:22 PM   #4
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,507
Blog Entries: 6

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

From here:

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.

Last edited by astrogeek; 10-17-2015 at 04:45 PM.
Old 10-18-2015, 02:06 AM   #5
Registered: Feb 2011
Distribution: Centos 6.7, 7
Posts: 689

Original Poster
Rep: Reputation: 69
Thank you for your ample answer.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] SELinux possible to allow role to type? cquick197 Linux - Security 2 04-22-2014 04:17 PM
[SOLVED] fdisk shows wrong partition type BlackTornado Linux - Newbie 3 03-06-2013 03:39 AM
partition type reader script/code robertjinx Programming 12 08-06-2010 09:10 AM
fdisk created fat32 partition, which type 0b or 0c? onedingo Linux - General 12 05-21-2008 08:56 AM
fdisk partition type question downinthemine Slackware - Installation 5 12-22-2003 08:52 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:02 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration