Skip to contentSkip to conversation

Partition IDs in the New World TM

DISCUSSION Andrew Clausen 9 participants 14 messages Jan 22, 2001 – Jan 24, 2001

lore
Share & tools
lore
#0 lore raw

Hi all,

We have roughly 10 different types of partition tables. We hate them, but it looks like they won't be going away for a long time.

Partition IDs seem to create a lot of confusion. For example, most people use 0x83 for both ext2 and reiserfs, on msdos partition tables. People use "Apple_UNIX_SVR2" for ext2 on Mac, etc.

Linux doesn't really use partition IDs. Well, not entirely true... it's used on Mac's as a heuristic, for finding swap devices, etc. - but I think this unnecessary.

LVM also uses it, but I also think it's unnecessary.

So, can anyone remember why we have partition IDs? (as opposed to just probing for signatures on the fs) If new partition table types come out (which is happening, believe it or not...), how should Linux/fdisk/parted handle IDs? Should we have one Linux type, that we use for everything? Should we have one type for each TYPE of data (file system, swap, logical volume physical device, etc.)?

Tchau,
Andrew Clausen
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#1 lore raw
Quoted 15 lines · Andrew Clausen

Hi all,

We have roughly 10 different types of partition tables. We hate them, but it looks like they won't be going away for a long time.

Partition IDs seem to create a lot of confusion. For example, most people use 0x83 for both ext2 and reiserfs, on msdos partition tables. People use "Apple_UNIX_SVR2" for ext2 on Mac, etc.

Linux doesn't really use partition IDs. Well, not entirely true... it's used on Mac's as a heuristic, for finding swap devices, etc. - but I think this unnecessary.

Quoted 8 lines

LVM also uses it, but I also think it's unnecessary.

So, can anyone remember why we have partition IDs? (as opposed to just probing for signatures on the fs) If new partition table types come out (which is happening, believe it or not...), how should Linux/fdisk/parted handle IDs? Should we have one Linux type, that we use for everything? Should we have one type for each TYPE of data (file system, swap, logical volume physical device, etc.)?

For compatability with dual booting other operating systems. Would you want Windows walking over your ext2 filesystems? Linux didn't invent the partition table schemes, it just borrows from those that are most common for a given architecture (ie. msdos on PC compatable systems, etc.)

--

Brian Gerst
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
In reply to Andrew Clausen
Quoted 5 lines · Brian Gerst

For compatability with dual booting other operating systems. Would you want Windows walking over your ext2 filesystems? Linux didn't invent the partition table schemes, it just borrows from those that are most common for a given architecture (ie. msdos on PC compatable systems, etc.)

Of course, we need to be careful of this kind of stuff. (That's the only reason we have partition tables in the first place!)

But, for "well behaved operating systems", can't we do it this way? (For the dos partition table scheme, 0x83 could be our "file system type", 0x82 our "swap type", or whatever)

Tchau,
Andrew Clausen
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
Quoted 3 lines · Andrew Clausen

But, for "well behaved operating systems", can't we do it this way? (For the dos partition table scheme, 0x83 could be our "file system type", 0x82 our "swap type", or whatever)

I think you're complaining about the partition IDs in this thread, and not the partition "schemes" that Linux supports. Am I right?

Well, the Linux kernel doesn't really care about partition IDs at all, except in one circumstance - to detect auto RAID partitions. Apart from that, the kernel couldn't care. You could set all your Ext2 partitions as ID 82, your swap as ID 83 and Linux would carry on as if nothing had changed.

About the only user programs that know about partition IDs are:
- fdisk (its part of the partition table format)
- installers (to stop users doing stupid things)

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#4 lore raw
Quoted 8 lines · Russell King
Quoted 3 lines · Andrew Clausen

But, for "well behaved operating systems", can't we do it this way? (For the dos partition table scheme, 0x83 could be our "file system type", 0x82 our "swap type", or whatever)

I think you're complaining about the partition IDs in this thread, and not the partition "schemes" that Linux supports. Am I right?

Well, I don't like either, hehe. But, partition IDs are the only thing I'm talking about here (the other was merely drive-by flaming)

Quoted 2 lines

Well, the Linux kernel doesn't really care about partition IDs at all, except in one circumstance - to detect auto RAID partitions.

Why is this necessary? Can't the RAID drivers probe the device for signatures, the same way file systems do?

(BTW: LVM does this too, and linux-ppc uses partition types as heuristics
for finding the root device, IIRC, and lots of other boring stuff. But, I suspect it isn't needed)

Quoted 4 lines

Apart from
that, the kernel couldn't care. You could set all your Ext2 partitions as ID 82, your swap as ID 83 and Linux would carry on as if nothing had changed.

Exactly. So, for new disk labels, or whatever, we should recommend to the relevant hackers that we have exactly one number for Linux. Or what?

Quoted 3 lines

About the only user programs that know about partition IDs are:
- fdisk (its part of the partition table format)
- installers (to stop users doing stupid things)

Exactly.

Andrew Clausen
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#5 lore raw
Quoted 2 lines · Andrew Clausen

Why is this necessary? Can't the RAID drivers probe the device for signatures, the same way file systems do?

One possible problem I can see here is to do with removal of RAID. Think of a RAID-1 array (2 or more disks containing identical data). The partition can be validly identified as an ext2 filesystem. But wait, it has a RAID superblock at the end.

How do we know if this superblock is current or not? After all, a mke2fs on the device won't remove it. Yes, you could fill the partition with zeros and start again, or you could just change the partition ID.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#6 lore raw
Quoted 5 lines · Russell King
Quoted 2 lines · Andrew Clausen

Why is this necessary? Can't the RAID drivers probe the device for signatures, the same way file systems do?

Quoted 8 lines

One possible problem I can see here is to do with removal of RAID. Think of a RAID-1 array (2 or more disks containing identical data). The partition can be validly identified as an ext2 filesystem. But wait, it has a RAID superblock at the end.

How do we know if this superblock is current or not? After all, a mke2fs on the device won't remove it. Yes, you could fill the partition with zeros and start again, or you could just change the partition ID.

Yeah, this is a big problem.

Parted solves it, by defining a clobber() operation for each file system type (which can/should be extended to RAID, if/when we get around to supporting it properly). clobber() removes all signatures.

So, I guess the short answer is: mke2fs should remove the RAID super. For those of you who don't like all-in-one libraries like libparted - not mentioning any Christo^Wnames - you could probably have clobber.ext2,
etc.

However, you would want to have a comprehensive set of clobber.*. Fortunately, clobber.X is going to be very small, so this should be a problem.

So, the alternative is to define a RAID partition "data" type. (And forget about IDs for file systems)

Andrew Clausen
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#7 lore raw
In reply to Russell King
Followup to:  <[email protected]>
By author:    Andrew Clausen <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 10 lines
Quoted 5 lines

Apart from
that, the kernel couldn't care. You could set all your Ext2 partitions as ID 82, your swap as ID 83 and Linux would carry on as if nothing had changed.

Exactly. So, for new disk labels, or whatever, we should recommend to the relevant hackers that we have exactly one number for Linux. Or what?

We have:

0x82 - Linux swap
0x83 - Linux filesystem
0x85 - Linux extended partition (yes, this one does matter!)

0x81 isn't Linux, but rather a Minix partition ID.

There seems to be some value in having a different value for swap. It lets an automatic program find a partition that does not contain data.

-hpa

Signature · 7 lines
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#8 lore raw
Quoted 8 lines · H. Peter Anvin

We have:

   0x82 - Linux swap
   0x83 - Linux filesystem
   0x85 - Linux extended partition (yes, this one does matter!)

There seems to be some value in having a different value for swap. It lets an automatic program find a partition that does not contain data.

What would be wrong with changing the kernel to skip the first page of swap, and allowing us to put a signature there? This would be really useful for systems that mount ext2 filesystems by LABEL or UUID. With the exception of swap, you currently don't need to care about what disk a filesystem is on. Of course, LVM also fixes this, but not everyone runs LVM.

Cheers, Andreas

Signature · 7 lines
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#9 lore raw
Quoted 11 lines · Andreas Dilger
Quoted 8 lines · H. Peter Anvin

We have:

   0x82 - Linux swap
   0x83 - Linux filesystem
   0x85 - Linux extended partition (yes, this one does matter!)

There seems to be some value in having a different value for swap. It lets an automatic program find a partition that does not contain data.

Quoted 7 lines

What would be wrong with changing the kernel to skip the first page of swap, and allowing us to put a signature there? This would be really useful for systems that mount ext2 filesystems by LABEL or UUID. With the exception of swap, you currently don't need to care about what disk a filesystem is on. Of course, LVM also fixes this, but not everyone runs LVM.

It already does that, you know. Nothing inherently wrong, *EXCEPT* that it breaks a bunch of programs already out there.

-hpa

Signature · 7 lines
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#10 lore raw
In reply to Andreas Dilger
Quoted 11 lines · Andreas Dilger
Quoted 8 lines · H. Peter Anvin

We have:

   0x82 - Linux swap
   0x83 - Linux filesystem
   0x85 - Linux extended partition (yes, this one does matter!)

There seems to be some value in having a different value for swap. It lets an automatic program find a partition that does not contain data.

Quoted 6 lines

What would be wrong with changing the kernel to skip the first page of swap, and allowing us to put a signature there? This would be really useful for systems that mount ext2 filesystems by LABEL or UUID. With the exception of swap, you currently don't need to care about what disk a filesystem is on. Of course, LVM also fixes this, but not everyone runs LVM.

LKCD starts writing a crash dump after the first page of the swap partition (if that is used as the dump partition), so I'd hate to see this implemented.

--Matt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#11 lore raw
Quoted 11 lines · Matt Robinson
Quoted 6 lines · Andreas Dilger

What would be wrong with changing the kernel to skip the first page of swap, and allowing us to put a signature there? This would be really useful for systems that mount ext2 filesystems by LABEL or UUID. With the exception of swap, you currently don't need to care about what disk a filesystem is on. Of course, LVM also fixes this, but not everyone runs LVM.

LKCD starts writing a crash dump after the first page of the swap partition (if that is used as the dump partition), so I'd hate to see this implemented.

I don't see how this applies... Now that I've been educated about how swap is set up, I see swap already uses the first page for config info and a signature. Adding some sort of label or ID to the swap info wouldn't affect swapping or LKCD in any way because it still wouldn't go past the first page.

It would already be possible to auto-enable any devices with the swap signature by doing the same sort of search mount(8) is doing for LABEL and UUID. The only drawback would be that you can't specify priority and usage order, and you can't auto-detect swap files. Swap files are not an issue because you can use the file name to locate them.

Cheers, Andreas

Signature · 7 lines
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#12 lore raw
In reply to Andrew Clausen
Quoted 24 lines · Andrew Clausen

Hi all,

We have roughly 10 different types of partition tables. We hate them, but it looks like they won't be going away for a long time.

Partition IDs seem to create a lot of confusion. For example, most people use 0x83 for both ext2 and reiserfs, on msdos partition tables. People use "Apple_UNIX_SVR2" for ext2 on Mac, etc.

Linux doesn't really use partition IDs. Well, not entirely true... it's used on Mac's as a heuristic, for finding swap devices, etc. - but I think this unnecessary.

LVM also uses it, but I also think it's unnecessary.

So, can anyone remember why we have partition IDs? (as opposed to just probing for signatures on the fs) If new partition table types come out (which is happening, believe it or not...), how should Linux/fdisk/parted handle IDs? Should we have one Linux type, that we use for everything? Should we have one type for each TYPE of data (file system, swap, logical volume physical device, etc.)?

Quoted 3 lines

Tchau,
Andrew Clausen

As far as i know partition ID's are only supposed to say what type of filesystems is on a partition, which is a totally stupid and crappy idea that makes no sense whatsoever (i feel strongly about this).

Linux filesystems have a filesystem type field in the filesystems superblock, which is what mount -a tries to use to guess the filesystem, the problem is that this flag isnt in the same place, so its not as valuable as it should be.

Have a partition marker to indicate the filesystem is stupid because the two are totally independent, of course i can format a filesystem of type 0x82 with whatever filesystem i want, and then there is also sorts of confusion when the partition table says the wrong thing.

In an ideal world the filesystem superblock flag for any filesystem type would be easy to get to, and then would also be a partition_table flag magic bit that indicates the type of partition table (i.e. pc_bios, solaris, bsd, atari/amiga, LVM) with the absence of the partition_type flag you could assume it was a whole disk and check my reading the superblock filesystem.

But of course you could never have an idealistic thing such as this becuase different people would have to agree on one place for the flags.

Glenn
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#13 lore raw

The bios on my laptop will only enable the suspend to disk function, if there is a partion on the disk that is 'IBM Thinkpad hibernation' (and it is a primary partition).

So, linux may not care but lots of other things that users rely on do care.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/