Installer causes sector misalignment with Advanced Format hard drive

Project:Trisquel
Component:Installer
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Hardware used

Laptop: Thinkpad T61
Hard Drive: Western Digital Scorpio Black 500GB 2.5" (WD5000BPKT)

This hard drive uses Advanced Format and requires partitions to be aligned on specific sector multiples for optimal performance.

Intended action

During Installer's Manual partitioning step, do a manual partitioning with 1 Primary partition and 1 Extended partition with at least 4 Logical Partitions.

Result

After installation, Disk Utility displays "Warning: The partition is misaligned by XXX bytes. This may result in very poor performance. Repartitioning is suggested." when clicking on the Extended partition. The Primary partition and the Logical partitions did not show this warning.

Alternative attempts

Various different partitioning schemes were attempted with GParted prior to running the installer. During the Installer's Manual partitioning step the previously created partitions were marked to be formatted and matched to the various mount points. No size changes were made.

Attempt 1

The same original layout was made using the following settings:
* 1 MiB preceding each Primary/Logical partition.
* Align To: MiB
* Extended partition did not have 1 MiB preceding.

After partitioning, the sectors were properly aligned according to fdisk:

~# fdisk -u -l /dev/sda

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

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      206847      102400   83  Linux
/dev/sda2          206848   976773119   488283136    5  Extended
/dev/sda5          208896   105066495    52428800   83  Linux
/dev/sda6       105068544   121845759     8388608   82  Linux swap /
Solaris
/dev/sda7       121847808   792936447   335544320   83  Linux
/dev/sda8       792938496   876824575    41943040   83  Linux
/dev/sda9       876826624   976773119    49973248   83  Linux

After installation:

~# fdisk -u -l /dev/sda

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

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400   83  Linux
/dev/sda2          208894   976773119   488282113    5  Extended
Partition 2 does not start on physical sector boundary.
/dev/sda5          208896   105066495    52428800   83  Linux
/dev/sda6       105068544   121845759     8388608   82  Linux swap /
Solaris
/dev/sda7       121847808   792936447   335544320   83  Linux
/dev/sda8       792938496   876824575    41943040   83  Linux
/dev/sda9       876826624   976773119    49973248   83  Linux

Attempt 2

The same process as Attempt 1, but this time 1 MiB preceding was used when adding the extended partition.
Again, it was properly aligned after partitioning:

~# fdisk -l -u /dev/sda

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

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      206847      102400   83  Linux
/dev/sda2          208896   976773119   488282112    5  Extended
/dev/sda5          210944   105066495    52427776   83  Linux
/dev/sda6       105068544   121845759     8388608   82  Linux swap /
Solaris
/dev/sda7       121847808   792936447   335544320   83  Linux
/dev/sda8       792938496   876824575    41943040   83  Linux
/dev/sda9       876826624   976773119    49973248   83  Linux

After installation:

~# fdisk -l -u /dev/sda

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

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400   83  Linux
/dev/sda2          210942   976773119   488281089    5  Extended
Partition 2 does not start on physical sector boundary.
/dev/sda5          210944   105066495    52427776   83  Linux
/dev/sda6       105068544   121845759     8388608   82  Linux swap / Solaris
/dev/sda7       121847808   792936447   335544320   83  Linux
/dev/sda8       792938496   876824575    41943040   83  Linux
/dev/sda9       876826624   976773119    49973248   83  Linux

Notes

I did not test with the default install option (Use entire disk).

Thu, 05/10/2012 - 11:57

Possible workarounds

Workaround 1: Use only Primary partitions

Using GParted, create only Physical partitions with the following settings:
* 1 MiB preceding
* Aligned to MiB

The default boot record uses MBR and allows only 4 primary partitions.

Workaround 2: GUID Partition Table (GPT)

If you need more than 4 partitions, use GParted to create a new GPT partition table. This might possibly not be supported by older hardware.

You will need to add a small (<=4MiB) partition at the front for the BIOS boot information. Thereafter you can add Physical partitions.
All these partitions should use the same settings as above.

In addition, the small BIOS boot partition needs to have the "bios_grub" flag set. Without this partition GRUB will not install.

Thereafter you can run the installer and select the appropriate mount points. Do not assign anything to the small BIOS boot partition.

Note that in both of these workarounds you will end up with 1 MiB-sized partitions between all your actual partitions. You can ignore those.

After installation your partitions should still be correctly aligned.