Comment 4 for bug 591909

Revision history for this message
Luis Mondesi (lemsx1) wrote :

I believe this bug boils down to the disk being partition in the wrong way by d-i. Take a look at this:

root@zod[~]# cfdisk /dev/sdb
FATAL ERROR: Bad primary partition 1: Partition ends in the final partial cylind
                          Press any key to exit cfdisk

root@zod[~]# fdisk -l /dev/sdb

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000aba37

   Device Boot Start End Blocks Id System
/dev/sdb1 * 1 32 248832 fd Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sdb2 32 60802 488136704 fd Linux raid autodetect

As you can see here, sdb1 would take the full drive since it starts at cylinder 1 and ends in 32, but sdb2 starts at 32 and ends in 60802.

This confuses mdadm when re-assembling the RAID1 array as the first partition (sda1), the second partition (sda2) and the full disk (sda) will have the same superblock!

If you preseed a system without RAID, it will boot normal and the system will somehow manage to work, even though the partitions will have the same problem mentioned above.

Example:
root@zod[~]# fdisk -l /dev/sda

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00004c34

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 32 248832 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 32 60802 488135681 5 Extended
/dev/sda5 32 59328 476296192 83 Linux
/dev/sda6 59328 60802 11838464 82 Linux swap / Solaris

root@zod[~]# cfdisk /dev/sda
FATAL ERROR: Bad primary partition 1: Partition ends in the final partial cylind

If I partition the disk using cfdisk (fdisk /dev/sdb and use "o" to remove the partition table so I get a clean mbr), then the partitions have the right start-end cylinders:

root@zod[~]# fdisk -l /dev/sdb

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd276e505

   Device Boot Start End Blocks Id System
/dev/sdb1 1 31 248976 83 Linux
/dev/sdb2 32 60801 488135025 fd Linux raid autodetect

This is a very serious bug and it's amazing to see that nobody has reported this before. Perhaps because I've been trying to find a solution for raid+lvm preseed and didn't look for "debian installer wrong partition cylinder" instead.