Linux – Correct starting sector for partition table on LVM

linuxlvm

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?

Best Answer

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).