[parted-devel] [PATCH] to correctly sync partitions with kernel

Joel Granados Moreno jgranado at redhat.com
Wed Feb 18 21:01:10 UTC 2009


Hello list.

So this issue sprouts from an issue mentioned by Petr Uzel a while back.
As I understood it, it had to do with parted failing when reading
partition 17 and there was a patch changing PED_MAX to PED_MIN.  After
this there were other patches that made parted missbehave.

Specifically parted was not correctly removing the partition file
(/dev/sdaNUMBER) when removing the last partition.  This patch helps to
address that.

What is happening is that _disk_sync_part_table is removing all
partitions and then adding the ones that it has in the PedDisk.  For
this logic to work we need to try to remove the maximum ammount of
parts.  And the maximum supported partitions is the minumum between the
number supported by the kernel (/sys/block/sda/range) and the maximum
suported by the label.

I hardcoded the label maximums.  If there is another way, pls advise.

I still have not seen the possibility to create a test for this,  will
look into it shortly.

A review is greatly appreciated.  Note that this is not the final patch
and the comments will be changed.

Regards.

Joel Andres Granados
Brno, Czech Republic, Red Hat.



More information about the parted-devel mailing list