Say I've got an LVM logical volume that I'm going to pass to a virtual machine (Xen, but I don't think this matters) to be used as a whole disk. The virtual machine is going to see that as /dev/xvda and expect a partition table on it.

Tools like fdisk like to suggest a starting sector of 63 for the first partition, but given the possibility of 4KiB sectors on the host, I think this could lead to future alignment problems causing performance issues.

What is a safe way to determine the starting sector of the first partition? How much space at the start should be left for a bootloader?

I think if I stuck to multiples of 8 for a starting sector (thus working for storage with 512B or 4,096B sectors) that would cover alignment. Since fdisk seems to like sector 63, perhaps it would be best to start at sector 64?


You can use block devices without partitioning them. Yes, Linux will print a message that it couldn't find a partition table on the device but it's harmless.

That being said, only old fdisks suggest using sector 63 for first partition. New fdisk and parted use 4MiB as the starting place for first partition.

As such, if you don't need LVM functionality on the guest (LVM on LVM), it's best to use raw partitions and align them properly on the host (4KiB vs 512B sectors are less of a problem than RAID stripe alignment).

  • Thanks @hubert-kario. I need to use partitions because most operating system installers don't like to install directly on to a disk device, even though it works fine. Having the user be able to (later) use the installer that is supported by their operating system is preferable to any saving due to getting rid of a partition table. So, 4MiB it is, thanks. – grifferz Jan 16 '12 at 8:55

Firstly, the mis-alignment issue only matters if the harddisk is based on RAID/SAN. Secondly, the optimal starting sector depends on the "stripe size" of the SAN/RAID As the default stripe size of RAID is likely < 512KB, so start from sector 256 should be safe. Or start from sector 512 (1Mb) to be sure

More on http://honglus.blogspot.com/2009/08/align-partitions-on-stripe-boundary-for.html

  • Mis-alignment can also happen with disks that use native 4k sectors but report 512 byte sectors. Most 2TB and bigger disks use 4k native sectors. – Dan Pritts Nov 1 '12 at 21:28

You could use gparted and it offers alignment to 1MiB boundary. I think it is safe bet for most situations and I personally use this scheme as a default for all my needs. Other Linux tools may also support this scheme, but I only have experience with gparted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.