bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: resizing FAT partition


From: Andrew Clausen
Subject: Re: resizing FAT partition
Date: Mon, 20 Nov 2000 06:41:43 +1100

Hi Hubert,

address@hidden wrote:
> I tried to resize a FAT partition using parted and I have the
> following problem:
> I use parted from the bootdisk;
>
> the old partition table is:
> 
> 1 0.031 1500  ext2
> 2 1500  2200  FAT
> 3 2200  3000  FAT
> 
> I want to remove the first partition and resize the second.
> I do the commands:
> 
> rm 1
> resize 2 0.031 2000
> 
> parted asks if I want a FAT32; I say OK, some disk activity
> no error message but the new partition as ext2 type instead
> of FAT as expected (shown by the print command) and of course
> windows doesn't accept to boot. So I have done
> 
> rm 2
> mkpart primary FAT 1500 2200
> 
> and I recover the old partition.

Ouch!  I see what's happening here.  It's rather complicated.
Your file system has been correctly resized, but, there are
still remnants of the old ext2 file system hanging around.

When Parted goes to change the partition type in the partition
table, it examines the file system (and, at this stage, has
forgotten that it just did an operation with a FAT partition).
It has found the remnants of the ext2 file system, and gotten
confused.

This bug is easy to fix... to the hackers on the list:
* I'll add ped_file_system_clobber_exclude(),
that accepts a PedGeometry, on which to exclude "clobbering".
Since signatures, etc are always at the start, that's all
we care about.

static int
ped_file_system_clobber_exclude (PedGeometry* geom,
                                PedGeometry* exclude)
{
        PedGeometry*    clobber_geom;
        int             status;

        if (ped_geometry_test_sector_inside (exclude, geom->start))
                return 1;

        clobber_geom = ped_geometry_duplicate (geom);
        if (ped_geometry_test_overlap (clobber_geom, exclude))
                ped_geometry_set_end (clobber_geom, exclude->start - 1);

        status = ped_file_system_clobber (clobber_geom);
        ped_geometry_destroy (clobber_geom);
        return status;
}

Then we would call:

        ped_file_system_clobber (new_geom, old_geom);

On ped_file_system_{resize,copy}().

Note to installer-maintainers: I don't think this creates Issues
for installers that use Parted, because ext2 is probed before fat,
and it's unlikely that many people will be moving FAT partitions
onto old ext2 partitions.

Note2: [lib]parted 1.2 doesn't have ped_file_system_clobber().
Does anyone want to convince me to add it to 1.2?

Thanks a LOT for this bug report!
I'll let you know when I release a version that fixes the
problem.  (Probably in 2 days time, because I have an exam...
depends how much stressing I intend to do ;-)

Andrew Clausen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]