Understanding Linux LVM: From Raw Disks to a Mounted Filesystem
A practical Incus lab exploring LVM physical volumes, volume groups, logical volumes, extent allocation and ext4, using real Linux command output.
On this page
- The lab environment
- The LVM storage hierarchy
- Creating the physical volumes
- Creating the volume group
- Why 9.99 GiB rather than 10 GiB?
- Creating the logical volume
- Where did LVM allocate the storage?
- Examining the logical volume as a block device
- What fdisk reveals
- Creating an ext4 filesystem
- Sectors, extents and filesystem blocks
- Mounting the filesystem
- Why does df report only 1.8 GiB available?
- The final block device layout
- What changed at each stage?
- Final storage configuration
- Command reference
- What I learned
Two 5 GiB disks, a 2 GiB logical volume and a mounted ext4 filesystem. That was the configuration I built in this lab with Linux Logical Volume Manager (LVM).
Rather than just memorising the commands needed to create a logical volume, I wanted to understand what actually changes at each stage, how LVM allocates the underlying storage and why different Linux tools report different information about the same devices.
I ran commands such as lsblk, fdisk -l, pvs, vgs and lvs throughout the lab to observe those changes. All of the terminal output in this article comes from the lab, with repeated output and unrelated fields removed for readability.
The lab environment
I’m using an Ubuntu virtual machine (ubuntu-2604-v1) running inside Incus, with two additional 5 GiB virtual disks attached.
The first thing I did was identify the available block devices:
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 10G 0 disk
├─sda1 8:1 0 100M 0 part /boot/efi
└─sda2 8:2 0 9.9G 0 part /
sdb 8:16 0 5G 0 disk
sdc 8:32 0 5G 0 disk| Device | Size | Purpose |
|---|---|---|
/dev/sda |
10 GiB | Operating system |
/dev/sdb |
5 GiB | LVM lab storage |
/dev/sdc |
5 GiB | LVM lab storage |
The two additional disks have no partitions. LVM can use either whole block devices or partitions as physical volumes; for this lab, I used the whole disks directly.
The LVM storage hierarchy
LVM introduces a storage abstraction between the underlying block devices and the filesystems that use them.
| Term | Abbreviation | Role |
|---|---|---|
| Physical volume | PV | A block device initialised for use by LVM |
| Volume group | VG | A pool of storage supplied by one or more physical volumes |
| Logical volume | LV | A logical block device allocated from a volume group |
| Physical extent | PE | A fixed-size allocation unit within a physical volume |
| Logical extent | LE | The corresponding allocation unit within a logical volume |
The configuration I was aiming for looked like this:
/dev/sdb (5 GiB) /dev/sdc (5 GiB)
│ │
Physical volume Physical volume
│ │
└───────────┬───────────┘
│
Volume group
vg_lab (9.99 GiB)
│
Logical volume
lv_data (2 GiB)
│
ext4 filesystem
│
/mnt/dataThe volume group would retain the remaining capacity for future logical volumes or extensions to the existing one. Combining disks into a volume group does not, by itself, provide redundancy.
Creating the physical volumes
I started by initialising both additional disks using pvcreate:
# pvcreate /dev/sdb /dev/sdc
Physical volume "/dev/sdb" successfully created.
Physical volume "/dev/sdc" successfully created.The pvs command provides a concise summary of the physical volumes:
# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb lvm2 --- 5.00g 5.00g
/dev/sdc lvm2 --- 5.00g 5.00gBoth devices are now recognised by LVM, but the VG column is empty because they do not belong to a volume group yet.
The more detailed pvdisplay output also revealed something worth noting (selected output for /dev/sdb):
# pvdisplay
"/dev/sdb" is a new physical volume of "5.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb
VG Name
PV Size 5.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0At this point the physical volume is initialised, but it has no extent size or extent allocation yet. These are established when it joins a volume group.
Despite the changes made by pvcreate, the plain lsblk and fdisk -l outputs looked the same as before. Neither command displayed the new LVM membership information. That does not mean nothing changed: pvcreate writes LVM labels and metadata to the devices. A filesystem/signature-oriented view, such as lsblk -f, can also identify the LVM2_member signature, although I did not capture that output in this lab.
Creating the volume group
Next, I combined the two physical volumes into a single volume group named vg_lab:
# vgcreate vg_lab /dev/sdb /dev/sdc
Volume group "vg_lab" successfully createdRunning pvs again now shows both physical volumes as members of the same volume group:
# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb vg_lab lvm2 a-- <5.00g <5.00g
/dev/sdc vg_lab lvm2 a-- <5.00g <5.00gThe vgs command summarises the volume group itself:
# vgs
VG #PV #LV #SN Attr VSize VFree
vg_lab 2 0 0 wz--n- 9.99g 9.99gThe group contains two physical volumes (#PV), no logical volumes (#LV) and no snapshots (#SN). The VSize and VFree columns show that the entire reported 9.99 GiB is available for allocation.
Once again, the plain lsblk and fdisk -l outputs remained unchanged. Creating a volume group establishes a pool of storage, not a new block device that can be formatted or mounted.
Why 9.99 GiB rather than 10 GiB?
The first interesting detail was that combining two 5 GiB disks resulted in a volume group reporting 9.99 GiB rather than exactly 10 GiB.
The answer becomes clearer when looking at the detailed output from pvdisplay (selected output):
# pvdisplay
--- Physical volume ---
PV Name /dev/sdb
VG Name vg_lab
PV Size 5.00 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 1279
Free PE 1279
Allocated PE 0
--- Physical volume ---
PV Name /dev/sdc
VG Name vg_lab
PV Size 5.00 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 1279
Free PE 1279
Allocated PE 0Each physical volume has 1,279 usable physical extents, each 4 MiB in size. Physical extents are the units in which LVM allocates storage.
Each raw disk contains 5,120 MiB, of which 5,116 MiB can be allocated as whole extents in this configuration:
1,279 × 4 MiB = 5,116 MiB per physical volume
2,558 × 4 MiB = 10,232 MiB across both physical volumes
≈ 9.99 GiBThe remaining 4 MiB per disk is unavailable for extent allocation. This accounts for space needed for LVM’s on-disk structures and alignment, as well as space that cannot fit into a complete extent. It does not mean LVM metadata alone occupies exactly 4 MiB on each disk.
The detailed volume group report confirms the extent calculation (selected output):
# vgdisplay
--- Volume group ---
VG Name vg_lab
Format lvm2
Metadata Areas 2
VG Access read/write
VG Status resizable
Cur LV 0
Cur PV 2
Act PV 2
VG Size 9.99 GiB
PE Size 4.00 MiB
Total PE 2558
Alloc PE / Size 0 / 0
Free PE / Size 2558 / 9.99 GiBThere are now 2,558 extents in the volume group, and none have been allocated to a logical volume.
Creating the logical volume
Rather than allocating the entire volume group immediately, I created a single 2 GiB logical volume named lv_data:
# lvcreate -L 2G -n lv_data vg_lab
Logical volume "lv_data" created.The -L option specifies the size, -n specifies the logical volume name, and the final argument specifies the volume group to allocate storage from.
The lvs command confirms that the logical volume has been created:
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_data vg_lab -wi-a----- 2.00gThe group now contains one logical volume, with approximately 7.99 GiB still free:
# vgs
VG #PV #LV #SN Attr VSize VFree
vg_lab 2 1 0 wz--n- 9.99g 7.99gThis is one of the useful properties of LVM: I can allocate the capacity I need now and keep the rest available for later, rather than deciding on a fixed partition layout up front.
Where did LVM allocate the storage?
I had combined two disks into a single pool, so I wanted to see which physical volumes actually supplied the storage for the new logical volume.
# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb vg_lab lvm2 a-- <5.00g <3.00g
/dev/sdc vg_lab lvm2 a-- <5.00g <5.00gAll 2 GiB had been allocated from /dev/sdb. The second disk, /dev/sdc, remained completely unallocated in LVM terms.
A standard linear logical volume does not automatically stripe its data evenly across all physical volumes in a volume group. LVM’s allocation policy determines where extents are placed; the particular disk selected in this lab is not a guarantee for other configurations. Striping and mirroring are separate layout choices.
The detailed pvdisplay output shows exactly how many extents were allocated (selected output):
# pvdisplay
--- Physical volume ---
PV Name /dev/sdb
VG Name vg_lab
PE Size 4.00 MiB
Total PE 1279
Free PE 767
Allocated PE 512
--- Physical volume ---
PV Name /dev/sdc
VG Name vg_lab
PE Size 4.00 MiB
Total PE 1279
Free PE 1279
Allocated PE 0The figures match the requested logical volume size:
2 GiB = 2,048 MiB
2,048 MiB ÷ 4 MiB per extent = 512 extentsThe volume group’s detailed report confirms the same allocation (selected output):
# vgdisplay
VG Name vg_lab
VG Size 9.99 GiB
PE Size 4.00 MiB
Total PE 2558
Alloc PE / Size 512 / 2.00 GiB
Free PE / Size 2046 / 7.99 GiBThe remaining 2,046 extents can be used to extend lv_data or create additional logical volumes. Notice that allocated LVM extents are not the same as used filesystem space: the whole 2 GiB is allocated to this logical volume whether or not it contains any files.
Examining the logical volume as a block device
Unlike the earlier stages, creating the logical volume changed the output of lsblk:
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 10G 0 disk
├─sda1 8:1 0 100M 0 part /boot/efi
└─sda2 8:2 0 9.9G 0 part /
sdb 8:16 0 5G 0 disk
└─vg_lab-lv_data 252:0 0 2G 0 lvm
sdc 8:32 0 5G 0 diskThe new 2 GiB device appears underneath /dev/sdb, with a device type of lvm. It does not appear underneath /dev/sdc, which agrees with what pvs and pvdisplay reported about the extent allocation.
The detailed logical volume report provides additional information (selected output):
# lvdisplay
--- Logical volume ---
LV Path /dev/vg_lab/lv_data
LV Name lv_data
VG Name vg_lab
LV Write Access read/write
LV Status available
# open 0
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Block device 252:0The logical volume has 512 logical extents, corresponding to the 512 physical extents allocated to it in this linear mapping. It is available as a block device, but it has not yet been formatted or mounted.
What fdisk reveals
Running fdisk -l now also reveals an additional block device (selected output):
# fdisk -l
Disk /dev/mapper/vg_lab-lv_data: 2 GiB, 2147483648 bytes, 4194304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesThis is the part I found particularly useful: even though the storage comes from an existing disk, Linux sees the logical volume as a block device in its own right.
LVM uses the kernel’s Device Mapper framework to map logical block devices to underlying storage. The following two paths both refer to the same mapped device in this lab:
/dev/vg_lab/lv_data
/dev/mapper/vg_lab-lv_dataThe logical volume behaves like a block device, so there is no need to create a partition table or another partition inside it for this use case. I can create a filesystem directly on the logical volume.
Creating an ext4 filesystem
At this point I had a logical block device, not yet a usable filesystem. I formatted it as ext4:
# mkfs.ext4 /dev/vg_lab/lv_data
mke2fs 1.47.2 (1-Jan-2025)
Discarding device blocks: done
Creating filesystem with 524288 4k blocks and 131072 inodes
Filesystem UUID: b59c7ffe-c28d-4f99-8232-67f6ebaf712a
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: doneThe command created an ext4 filesystem with 524,288 blocks of 4 KiB, 131,072 inodes and a journal consisting of 16,384 blocks (64 MiB). It also generated a filesystem UUID, which is distinct from the LVM physical volume, volume group and logical volume UUIDs.
Sectors, extents and filesystem blocks
By this stage, three different storage units had appeared in the command output:
| Storage layer | Unit | Unit size | Count in the 2 GiB LV |
|---|---|---|---|
Block device (fdisk) |
Sector | 512 bytes | 4,194,304 |
LVM (lvdisplay) |
Logical extent | 4 MiB | 512 |
ext4 (mkfs.ext4) |
Filesystem block | 4 KiB | 524,288 |
These are different ways of describing the same raw capacity:
4,194,304 × 512 bytes = 2 GiB
512 × 4 MiB = 2 GiB
524,288 × 4 KiB = 2 GiBLVM allocates storage to logical volumes using extents, while ext4 manages files and its own internal structures using filesystem blocks. The block device, meanwhile, is addressed in sectors. These layers are related, but the units are not interchangeable.
Mounting the filesystem
With the filesystem created, the final step was to make it accessible through the Linux directory hierarchy.
mkdir -p /mnt/data
mount /dev/vg_lab/lv_data /mnt/data/I then checked the mounted filesystem with df -h (selected output):
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 9.6G 1.3G 8.4G 13% /
/dev/sda1 99M 8.6M 90M 9% /boot/efi
/dev/mapper/vg_lab-lv_data 2.0G 536K 1.8G 1% /mnt/dataThe logical volume is now mounted at /mnt/data and ready to store files.
Why does df report only 1.8 GiB available?
The logical volume is 2 GiB in size, but df -h reports approximately 1.8 GiB available, even though the filesystem is newly created.
Some of the underlying capacity is needed for ext4’s own structures, such as inode tables, superblocks and the journal. ext4 also normally reserves a percentage of blocks (5% by default) for privileged use. Those reserved blocks are not included in the space reported as available to ordinary users by df.
The numbers in df -h are rounded, so the exact breakdown cannot be calculated from this output alone. I did not inspect the filesystem’s reserved block count in this lab.
This distinction is worth remembering: lvs reports the capacity of the logical block device, whereas df reports filesystem-level capacity and usage. They are not measuring quite the same thing.
The final block device layout
One final run of lsblk confirms the device hierarchy and mount point:
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 10G 0 disk
├─sda1 8:1 0 100M 0 part /boot/efi
└─sda2 8:2 0 9.9G 0 part /
sdb 8:16 0 5G 0 disk
└─vg_lab-lv_data 252:0 0 2G 0 lvm /mnt/data
sdc 8:32 0 5G 0 diskThe logical volume is still backed entirely by /dev/sdb, and /dev/sdc remains a member of the volume group with all its usable extents available for future allocation.
I also ran fdisk -l again after mounting the filesystem. Its output was identical to the earlier report following lvcreate. Formatting and mounting had not changed the block device’s size or partition layout.
The mount was created manually and is not configured to persist across reboots. Making it persistent would require an appropriate /etc/fstab entry or another persistent mount configuration. I haven’t done that as part of this lab.
What changed at each stage?
One of the most useful parts of the lab was observing which inspection commands revealed changes at each stage, rather than simply checking whether the creation commands succeeded.
| Operation | What changed |
|---|---|
pvcreate |
Both devices appeared in pvs; plain lsblk and fdisk -l were unchanged. |
vgcreate |
The devices gained VG membership and allocatable extents; vgs showed a new pool. |
lvcreate |
lvs showed a new LV; lsblk and fdisk -l showed a new mapped block device. |
mkfs.ext4 |
A filesystem was created on the LV; its block device capacity did not change. |
mount |
lsblk showed the mount point and df -h showed the mounted filesystem. |
The distinction between the inspection tools is equally important:
| Command | What it examines |
|---|---|
lsblk |
Block devices, their relationships and mount points |
fdisk -l |
Block device geometry and partition tables |
pvs / pvdisplay |
Physical volumes and extent allocation |
vgs / vgdisplay |
Volume groups and available capacity |
lvs / lvdisplay |
Logical volumes and their allocated capacity |
df -h |
Mounted filesystem capacity and usage |
The short LVM reporting commands (pvs, vgs and lvs) are useful for a quick overview, while the corresponding *display commands provide more detail about the storage configuration.
Final storage configuration
| Property | Value |
|---|---|
| Physical volumes | /dev/sdb, /dev/sdc (5 GiB each) |
| Volume group | vg_lab |
| VG capacity | 9.99 GiB |
| VG free capacity | 7.99 GiB |
| Logical volume | lv_data |
| LV capacity | 2 GiB |
| Physical extent size | 4 MiB |
| Total physical extents | 2,558 |
| Allocated physical extents | 512 |
| Free physical extents | 2,046 |
| Filesystem | ext4 |
| Filesystem block size | 4 KiB |
| Mount point | /mnt/data |
| Available filesystem space | 1.8 GiB (as reported by df -h) |
| Persistent mount | Not configured |
Command reference
The configuration itself took six commands. The rest of the lab involved inspecting the system and understanding what those commands had changed.
For reference, these are the commands I ran to create the configuration, after identifying the correct disposable disks:
# Initialise the physical volumes
pvcreate /dev/sdb /dev/sdc
# Combine them into a volume group
vgcreate vg_lab /dev/sdb /dev/sdc
# Allocate a 2 GiB logical volume
lvcreate -L 2G -n lv_data vg_lab
# Create the filesystem
mkfs.ext4 /dev/vg_lab/lv_data
# Create the mount point and mount the filesystem
mkdir -p /mnt/data
mount /dev/vg_lab/lv_data /mnt/data/What I learned
The basic concept of LVM is straightforward: physical volumes are combined into volume groups, from which logical volumes are created. Working through the process and inspecting the storage at each stage helped make the relationship between those layers much more concrete.
The most interesting observation was that combining two disks into a volume group didn’t mean the resulting logical volume used both of them. All 512 extents were allocated from a single disk, leaving the other disk available for future use.
I also found it useful to distinguish between the various measures of free space. The volume group still has 7.99 GiB available for new or extended logical volumes, while the mounted filesystem has around 1.8 GiB available for files. These figures describe different layers of the same storage configuration.
The next experiment I’d like to perform is extending lv_data beyond the remaining capacity of /dev/sdb. That should let me observe how LVM maps a logical volume across multiple physical volumes and how growing a logical block device differs from growing the filesystem that resides on it.