[parted-devel] about msdos 2T partition issue

Joel Granados jgranado at redhat.com
Tue Nov 18 07:57:28 UTC 2008


----- "xerces8" <xerces8 at butn.net> wrote:

> Preventing creating a MSDOS labelin a low level tool is wrong IMHO.
> A GUI can give a warning to the user, but parted should just do what 
> the user tells him too.
> 

This is a very valid point you make.  Actually I am really inclined to change the patch a bit and put a interactive warning instead of an error.  In this way, if you choose to create an msdos label on a disk that is greater than the msdos capacity, parted will tell you "be carefull, you probably wont be able to use all your disk.  do you still want to continue?"  So if the user hits "yes", its his own fault :).  In scripting mode, the behavior would be an automatic "yes", but the user would have to specify that the label should be msdos, because the default label for disks that are over 2^32 sectors is gpt.  So the same principle (It was the users decision) applies.

Thank you for the comment.  I'll rethink my patch and post another :)

Regards

> You know:
>  - no policy...
>  - give enough rope ...
> 
> ;)
> 
> 
> Regards,
> David
> 
> -----Original Message-----
> From: Joel Granados <jgranado at redhat.com>
> To: parted-devel <parted-devel at lists.alioth.debian.org>
> Date: Fri, 14 Nov 2008 13:29:00 -0500 (EST)
> Subject: [parted-devel] about msdos 2T partition issue
> 
> > 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



More information about the parted-devel mailing list