[parted-devel] about msdos 2T partition issue

Joel Granados jgranado at redhat.com
Fri Nov 14 18:29:00 UTC 2008


Hi list:

The 71bbe2995371357c534dccf1eb3d436b399eaf32 commit patches parted so it stops users from creating partitions that are greater than 2T.  IMO this patch is in the wrong place.

1. I think there is a misconception in the sense that the size is the one that is restricted.  This is not the case.  The size can actually be greater than 2T in msdos labels.  What is restricted is the sector count.  It is restricted to 2^32 (unsigned int).  And if you have 2^32-1 512 size sectors, you will have a partition of 2T.  Of course that can change if you change the sector size, and it will still be valid in the msdos label.  This does *not* mean we should not check and see how many sectors are in the disk and prevent the user from creating an msdos in a disk with more than 2^32 sectors.


2. can one have various partitions less then 2^32 sectors, but that all together sum up more than 2^32 sectors on an msdos label?  like if I had the 1st partition of size 1.8T and the second of 1.8T and a third partition of 1.8T (assuming 512 sector size).  IMO, no (pls correct me if I am wrong!!!!!)  As I understand it, the 32 bit restriction is on the drive and not the partitions because it not only contains the size but the start sector.  Now the 1.8T size can fit comfortably in the 32bit field, but the start sector cannot.  At least for the third partition it cant.

3. IMO the place to put the label specific stuff is not the libparted/disk.c file.  IMO the best place to put these restrictions specific to labels are in the label files themselves.  This issue, for example, belongs in the libparted/lables/dos.c file.  Whenever a dos label is being created we should check for these kind of things.

4.  Finally I propose replacing the current patch for this issue with something that prevents the user from creating a msdos label on a device that has more sectors than can be handled by the msdos label format.  (patch on the bottom).  IMO reverting the current patch and placing this one in its place would be the right thing to do because we wont get to the point of creating an msdos partition on a disk if we didn't create an msdos label to begin with :).  OTH we might come up to systems that have already made this mistake, in which case we simply need to tell the user that no partition can nor will be created.

If I am missing something please scream at me!!!!

New Patch:

-- 
Joel Andres Granados
Red Hat / Brno Czech Republic
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Stop-the-user-from-creating-msdos-labels-in-drives-t.patch
Type: application/octet-stream
Size: 0 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20081114/444887c4/attachment.obj 


More information about the parted-devel mailing list