Linux – Define physical volume inside non-partitioned disk

linuxlvmpartitionpv

I've been able to define a physical volume (LVM) in two ways:

  • Creating a 8e (Linux LVM type) partition and then # pvcreate /dev/sdb1
  • Usign pvcreate directly using a non-partitioned disk and then # pvcreate
    /dev/sdc
    <– note the lack of number since there aren't any partitions.

My disks are not local, I use both scenarios: SAN provided LUN and VMware provided disks in different systems. We are testing LUN/vmware disk online resizing and everything went fine with the PVs defined using non-partitioned disks but with the partition layer it was impossible to hot-resize them using parted or fdisk.

My question is: why should I bother using 8e partitions if I can use raw disks for creating physical volumes and then resizing them online?

Best Answer

This was asked recently but it was in the context of local disks. In that situation, there is a good reason to use a partition table on the disk even if you only intend to make it a single big partition spanning the entire disk: documenting the fact that the disk is actually in use, thus preventing accidents.

I believe that the situation is different for managed disks, whether it is network block devices, paravirtualized disk images, SAN LUNs, iSCSI, etc...

In this case, I think you should feel free to use whole disks directly, for the following reasons:

  • Trying to use partition tables on these disks is apparently giving you trouble with resizing. Logical disks of this type can be dynamically resized in ways that physical disks never can. If it's giving you trouble, save yourself that trouble and don't do it.
  • These types of disks often do not correspond to physical hard disks and won't be subject to the same kinds of "this disk appears to be blank" accidents that physical disks can.
  • The logical disks is often backed by something that is already container-like: an outer partition, an LVM LV, a virtual block device in a storage cluster and an extra layer of partitioning is probably superfluous.
Related Question