Quiz Entry - updated: 2026.07.14
What is the end-to-end workflow to turn a raw disk into mounted LVM storage?
Partition the disk and flag it for LVM → pvcreate → vgcreate → lvcreate → mkfs + mount: build up the PV→VG→LV layers, then format and attach.
Each step builds the next layer of the stack:
| # | Command | What it does | Which layer |
|---|---|---|---|
| 1 | parted / fdisk |
Create a partition, set its type to LVM | raw disk |
| 2 | pvcreate |
Stamp LVM metadata → it's now a PV | PV |
| 3 | vgcreate |
Pool one or more PVs into a group | VG |
| 4 | lvcreate |
Carve a logical volume out of the group | LV |
| 5 | mkfs + mount |
Put a filesystem on the LV and attach it | filesystem |
# 1. Partition and set the LVM flag so tools treat it as LVM space
parted /dev/vdb mklabel gpt mkpart primary 1MiB 769MiB
parted /dev/vdb set 1 lvm on
# 2. PV: initialize the partition for LVM
pvcreate /dev/vdb1
# 3. VG: create a pool named vg01 from that PV
vgcreate vg01 /dev/vdb1
# 4. LV: carve a 300 MiB logical volume named lv01
lvcreate -n lv01 -L 300M vg01
# 5. Format with XFS and mount it
mkfs -t xfs /dev/vg01/lv01
mount /dev/vg01/lv01 /mnt/data
Why the LVM flag in step 1? It's a hint in the partition table marking this space as belonging to LVM, so other tools (and a human reading parted) don't mistake it for an ordinary filesystem partition. The LV then appears at two equivalent paths: the friendly /dev/vg01/lv01 and the device-mapper name /dev/mapper/vg01-lv01.