[Parted-maintainers] Bug#299906: parted: mistakes ext2 for fat

Sven Luther Sven Luther <sven.luther@wanadoo.fr>, 299906@bugs.debian.org
Thu, 17 Mar 2005 14:50:06 +0100


On Thu, Mar 17, 2005 at 02:18:59PM +0100, A Mennucc wrote:
> On Thu, Mar 17, 2005 at 12:41:39PM +0100, Sven Luther wrote:
> > On Thu, Mar 17, 2005 at 12:21:51PM +0100, A Mennucc wrote:
> > > On Thu, Mar 17, 2005 at 11:37:36AM +0100, Sven Luther wrote:
> > > > On Thu, Mar 17, 2005 at 10:36:07AM +0100, A Mennucc wrote:
> > > > > Package: parted
> > > > > Version: 1.6.21-1
> > > > > Severity: important
> > > > > I have a USB memory stick; I have created one partition on it;
> > > > > the current layout is 
> > 
> > > btw: I doubt there is any vfat data around : I filled 
> > > the partition with my data almost completely
> > 
> > The magic marker for fat partition is probably kept, it is just one sector,
> > and probably living outside the ext2 accessible data or something.
> > 
> > > > How do you create the ext2 partition anyway ? 
> > > 
> > > with  'cfdisk /dev/sda' ; then I did 'mkfs.ext2 /dev/sda1'
> > 
> > If you had created the ext2 filesystem with parted, it would probably have
> > clobbered the old fat on it, not sure though.
> 
> before I used cfdisk, the usb stick was 'partionless' :
>  /dev/sda itself was one big fat partition

Ok, exact that then, there is some remnant of that fat filesystem in unused
places of your stick.

> > > my usb stick works perfectly well with : 
> > > fdisk, cfdisk , mount, etc etc 
> > 
> > Sure, but you can't use those for resizing.
> 
> that is currently my problem

bad luck. you could look at where those fat remnant are, and purge them by
hand. Or rebuild a parted with the order of ext/vat inversed, or simply
removed fat support. look at libparted/libparted.c i think.

> > Something more clever could
> > (and maybe should) be done, but this is a post-sarge issue which we need to
> > convince upstream of, and would probably require a not-so-small redesign.
> > Maybe for parted 1.7 or something.
> 
> Unless other people get bitten while 
> installing sarge. We will see.

You are free to take the matter upstream. parted for sarge is already in
deep-freeze, so i doubt changes of this magnitude will make it in.

> > > parted is the only program being fouled
> > 
> > Because the other blindly follow the partition table. Now if you had changed
> > the partition type in the partition table erroneously, parted would not be
> > fouled, but the others would, so ...
> 
> I see it the opposite way . The other tools use the standard 
> approach of looking at the type, and they work OK.
> 
> parted tries to be smarter than the rest, and fails. 

Ok.

> so this is a bug in parted 

Convince upstream about this please.

> the best behaviour should be:
> 1) parted looks at the type in the partition table
> 2) parted looks inside the partition and tries to guess
> 3) if the two guesses do not match, parted asks politely

Yep, indeed. but as said a not-so-small redesign (including probably an
ABI/API change) of parted is needed for that, so definitively post-sarge.

I would even add :

  4) allow for manual setting of the dostype, as well as inspection.

I had some disagreement with upstream about this, but it cannot be done in the
current stable branch.

Patches welcome as always though, and i would be happy if you could prove me
wrong on this.

Friendly,

Sven Luther