Hi,
I am writing a C program based on libparted that duplicates the partition table
from one disk to another disk. I want the properties of partitions to be
preserved (start, end, type, number, ...).
The problem I have is I would like the partition number to be preserved as
well, but libparted does not provide any function to set that number. It sounds
that ped_disk_enumerate_partitions() will automatically attribute numbers to
partitions so we cannot directly set it.
If we consider an original disk with two partition numbered 1 and 3 (partition
number 2 has been destroyed), how can I recreate the same partition table on
the new disk ? If I just call ped_partition_new() and ped_disk_add_partition()
two times, it will allocated numbers 1 and 2 instead of 1 and 3.
I was thinking I could create a fake partition 2, just to use the number, and I
would destroy at the end, but it won't work if partition 1 and 3 use 100% of
the disk space. It may be possible to first create all partitions (real + fake)
with a very small size, then remove the fake partitions, to finally grow the
real partitions, but it's very complicated.
What's the best way to do that ?
Thanks
_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel