Why can't we directly create a volume group over a disk without creating a physical volume from it?
What is a physical extent? Do we even have physical extents in a partition?
Why can't we directly create a volume group over a disk without creating a physical volume from it?
What is a physical extent? Do we even have physical extents in a partition?
The physical volume (PV) is simply the partition with LVM metadata added. You can't create the volume group (VG) without referring to the metadata, thus you have to first create the PV(s) that will be members of the VG. A physical extent (PE) is just that - the actual section of the disk that you're writing to, very similar to an old-style disk CHS (cylinder-head-sector) address. You will always have PEs in an LVM world.
A “physical volume” is LVM terminology for the underlying storage on which it puts data. Some typical examples of physical volumes include
A volume group is an intermediate abstraction layer between physical volumes (corresponding to the underlying storage) and logical volumes (each containing a filesystem (usually)). To “create volume group over a disk”, you need, by definition, to declare the disk as a physical volume for use by LVM.
A “physical extent” is just a consecutive chunk of 4MB (by default) on an LVM physical volume. It's an LVM concept, not a disk concept.
You can make a disk an LVM physical volume, but it tends to facilitate maintenance to first create a partition (a single partition if you want to use the whole disk) and make that partition an LVM physical volume. See The merits of a partitionless filesystem
So to use LVM on a single disk, say /dev/sda
:
fdisk
(or gdisk
, parted
, etc.) to create a partition sda1
.pvcreate /dev/sda1
to make the partition a physical volume.vgcreate mystorage /dev/sda1
to a volume group called mystorage
using the partition as storage space.lvcreate … mystorage
for each of the logical volumes you want to create.