Linux LVM: Single or Multiple Harddisk Partitions

linuxlvm

I am about to add a second harddisk to my server for data storage and have decided to use LVM. My plan is to use one volume group with server logical volumes. Since the disk is new I need to partition it first.

How many primary partitions should I create? What is the difference between the LVM filesystem built on s single-partition disk and one, say, on a four-partition disk?

Best Answer

I recommend creating one large whole-disk partition to contain the PV. Set the partition type to be "8e" (Linux LVM). The reason being that if the disk is moved to a different host in the future, it is obvious that the disk was used with LVM and could help prevent mistakes with the handling of the data.

A second reason for a whole-disk partition: if you run pvcreate /dev/sdX on a device that already has a partition table, the LVM will work correctly until a reboot, at which time the LVM drivers will have a hard time finding the PV. (The LVM drivers assume that if there is a partition table on a disk, the PV must be located within a partition.)