On 9/25/2015 1:01 PM, Rod Smith wrote: > I've seen this type of layout before. I don't know of anything that will > create it if given the choice, but I'm pretty sure that sfdisk will > create such a layout if it's forced to do so. You might try using sfdisk > to create a series of logical partitions with no gaps between them but a > big gap between the start of the extended partition and the first > logical partition to reproduce this behavior.
I remember that. Also, I once had something corrupt my NTFS filesystem and had to run the chkdsk from the installer cd to try and repair it, and it decided to replace the boot sector with a FAT one. Fortunately I found a hex editor and restored the backup copy from the middle of the volume. Windows bad... grr... > I wouldn't trust the Windows partitioning tools as far as I could throw > them if they were written to a CD-R made of solid neutronium. I've seen > too many tales over the years of them doing weird things with > partitions, and especially with extended and logical partitions. I > recall a rash of problem reports a few years ago in which the Windows XP > (IIRC) installer was converting a logical partition into a primary > partition but leaving it inside the extended partition. In other words, > it's entirely believable that the Windows tools set things up this way > -- but I certainly don't know that for a fact. Using sfdisk is likely to > be an easier way to reproduce the issue. I tried with fdisk first and it seems to insist on not just one sector but an entire cylinder ( wtf? ) between the partitions. I looked at sfdisk and it seems to only work in cylinders. Of course that was on my 14.04 system, so maybe I need to check a more recent version. > I've only looked at this briefly, but this line looks like it might be > something to do with manipulating the extended partition rather than a > logical partition. If part is the logical partition being created and if > part->prev is the extended partition, then this would be passing > ped_geometry_new() the start point of the extended partition and the > required size of the extended partition to hold the logical partition > being created. The sector argument gives the sector where the EBR it should write is located. The initial call gives it the first sector of the extended partition, i.e. the EBR for partition 5. Then when it recurses into itself, it passes the sector of part->prev->geom.start, where part is partition 6, and so it is passing the first sector of partition 5.