Does LVM need a disc-wide partition?
One nice thing about teaching courses is that I also get to learn. A wide range of attendees means a wide range of views. I was recently teaching Learning Tree’s Linux server administration course, which has a chapter on storage management with an emphasis on creating and expanding LVM storage.
An engineer with many years of storage experience with IBM’s AIX first thought I had confused my words when I mentioned adding a disk partition as a physical volume. No, that’s exactly what I meant to say. So now he thought Linux was bizarre.
“A disk is a physical volume.”
Well, not necessarily. UEFI firmware needs an ESP (or EFI System Partition), a FAT file system where the boot loader will be stored. Boot loaders like GRUB can’t handle the complexity of logical volumes. They need their own file system.
So, we need partitions for
/boot/EFI, with maybe 300 MB and 200 MB, respectively. But disks are routinely 1 TB and up these days. Compare that total of 0.5 GB for
/boot/EFI to today’s common disks starting around 1,000 GB. Shall we dedicate one physical disk to booting and leave 999.5 GB unused?
No, let’s use that terabyte in
sda3 along with the other full disks
sdc, and so on. One partition plus some complete disks.
I’m with the AIX logical volume management philosophy on the dedicated disks. Each added disk is simply another physical volume, let’s add that disk to the volume group.
This is where some people jump in and accuse me of skipping a step. One approach to LVM insists that you must create a GPT disk label (the successor for the early 1980s IBM-MBR partition table) on every disk. Then use that to define a partition spanning the remainder of the disk labeled as Linux LVM (type
0x82 in the old MBR scheme).
There is no technical reason not to do this. The disk label takes up a tiny fraction of the entire disk, just one megabyte. But at the same time there is no really compelling reason to add this complexity.
The argument I’ve seen multiple places is that tagging the partition with the LVM type
0x82 (and the argument is always fossilized in the IBM-MBR era) will make it clear to a clueless or careless system administrator that the disk isn’t blank, it contains valuable data.
If you have a system administrator who doesn’t know how to investigate storage devices, and who isn’t very cautious when manipulating storage, then that person should not have that role. All it takes is this command and a little thought:
# file -s /dev/sd*
The command-line tools detect an attempt to repurpose an LVM physical volume and require that you go out of your way to do so anyway. A graphical tool might allow casual dismissal of yet another warning box, but if your system administrator needs to use a GUI that is a bad sign.
The kernel handles all the device files with no problem, detecting what’s in disks and their partitions by reading their initial blocks, but let’s avoid unneeded complexity in
/dev. There’s no need to “partition”
sdb into a full device-spanning
A disk is a physical volume, a physical volume is a disk or a partition of a disk.