Volume Groups using unpartitioned vs partitioned disk

Latest response

Hello,

When it comes to create volume groups, I can see some people create vgs out of whole disk (sdb) while others use partitions (sdb1). What method is more advisable and why?

Kind regards,

Responses

There's little difference functionally. Often times on systems with more than one administrator disks with no partitions on them are considered available, and adding a partition to the disk marks it as used. There is also a situation where a KVM host will be able to see its guests LVM configuration unless the guest adds a partition before configuring LVM.

The flip side is changing the size of the disk is much simpler without a partition being involved.

Much of the value of partitioning when you're using the "whole disk" depends on the backing storage subsystem and, if you're doing virtualization, how much consolidation you're doing. It used to be recommended that you use partitioning so that you could force your storage objects to be aligned to your storage. Especially on virtualization hosts, having all your VMs aligned to the underlying storage would take pressure off the LUNs presented to the VMs through the virtualization host (no short stripe-writes getting sent to the array) Depending on your use-case, that's likely not as big of an issue these days.

And when you need particular data alignment, the newer versions of the pvcreate command can give it to you easily:

pvcreate --dataalignment 1M /dev/somedisk

would align the beginning of the first extent on the disk to be a multiple of exactly one (binary) megabyte, which is good for most storage systems.

To verify the alignment of existing LVM volumes (relative to the start of the LVM partition on partitioned disks) use "pvs -o +pe_start".

There's also the human factor. Many times people have seen a disk without a partition, considered it "unused", made a partition and started writing data. LVM will not scan a device with a partition, and the write of new data over the top often corrupts the contents of the LVM volume as well.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.