<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Hi,<br><br>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, ...). <br><br>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. <br><br>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.<br><br>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.<br><br>What's the best way to do that ?<br><br>Thanks<br><br></div> <!-- cg26.c41.mail.ird.yahoo.com compressed/chunked Sat Jan 23 13:42:51 PST 2010 --> </div><br>




      </body></html>