---
title: "LVM on Linux: create, mount and grow logical volumes · CloudSat"
description: "Set up LVM on Debian, Ubuntu, AlmaLinux or Rocky Linux: create volumes, mount them at boot with fstab, grow them online, shrink with care and take snapshots."
url: https://cloudsat.io/learn/set-up-lvm-on-linux-create-mount-extend
updated: 2026-11-18T12:00:00Z
source: CloudSat (https://cloudsat.io/). Prices in USD.
---

[Linux](https://cloudsat.io/learn/topic/linux)

# LVM on Linux: create, mount and grow logical volumes

Set up LVM on Debian, Ubuntu, AlmaLinux or Rocky Linux: create volumes, mount them at boot with fstab, grow them online, shrink with care and take snapshots.

CloudSat team November 18, 2026 7 min read

LVM, the Logical Volume Manager, puts a flexible layer between disks and filesystems. Instead of fixed partitions you get a pool of space that you can carve into volumes, grow while they are mounted, spread over several disks and snapshot. AlmaLinux and Rocky Linux install on LVM by default, and Ubuntu Server offers it in its guided layout. This guide builds a setup from scratch, mounts it at boot, grows it, shrinks it where that is possible, and uses snapshots.

## The three layers

- **Physical volume (PV):** a disk or partition prepared for LVM.
- **Volume group (VG):** a pool made of one or more PVs, divided into extents (4 MiB each by default).
- **Logical volume (LV):** a block device cut from the pool, visible as `/dev/<vg>/<lv>` and `/dev/mapper/<vg>-<lv>`. You put a filesystem on it like on any partition.

| Layer | Create | List | Details | Grow |
| --- | --- | --- | --- | --- |
| PV | `pvcreate` | `pvs` | `pvdisplay` | `pvresize` |
| VG | `vgcreate` | `vgs` | `vgdisplay` | `vgextend` |
| LV | `lvcreate` | `lvs` | `lvdisplay` | `lvextend` |

## Is LVM already there?

```bash
lsblk                    # LVs appear with TYPE lvm
sudo pvs; sudo vgs; sudo lvs
```

Look at the `VFree` column of `vgs`. Ubuntu Server's guided LVM layout can leave part of the volume group unallocated, which is why a fresh install sometimes shows a root filesystem much smaller than the disk. One command hands the free space to root and grows the filesystem with it:

```bash
sudo lvextend -r -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
```

## Install the tools and practice safely

```bash
sudo apt install lvm2        # Debian and Ubuntu
sudo dnf install lvm2        # RHEL family
```

Mistakes on a real disk destroy data, so rehearse on loop devices first. Two image files become two fake disks:

```bash
sudo truncate -s 2G /var/tmp/pv1.img /var/tmp/pv2.img
sudo losetup --find --show /var/tmp/pv1.img     # prints for example /dev/loop0
sudo losetup --find --show /var/tmp/pv2.img     # and /dev/loop1
```

## Create the volume group and volumes

On a real server, replace the loop devices with the empty disk you want to use, for example `/dev/vdb`. Check that it really is empty first: `lsblk -f /dev/vdb` and `sudo wipefs -n /dev/vdb` list any existing partitions and filesystem signatures without changing anything.

```bash
sudo pvcreate /dev/loop0 /dev/loop1
sudo vgcreate data /dev/loop0 /dev/loop1
sudo lvcreate -n www -L 1G data          # fixed size
sudo lvcreate -n backup -l 50%FREE data  # half of what is left
sudo mkfs.ext4 /dev/data/www
sudo mkfs.xfs /dev/data/backup
```

`-L` takes a size, `-l` takes extents or a percentage of the VG or of its free space. Leaving some space unallocated is a good habit: it is what you grow into later, and what snapshots need.

Pick the filesystem with resizing in mind. ext4 grows online and shrinks offline. XFS, the RHEL-family default, grows online but cannot shrink at all.

## Mount now and at boot

```bash
sudo mkdir -p /srv/www /srv/backup
sudo mount /dev/data/www /srv/www
sudo mount /dev/data/backup /srv/backup
```

Add both to `/etc/fstab`. LV paths are stable, unlike `/dev/sdb`-style names, so they are safe to use; UUIDs from `lsblk -f` work too.

```text
/dev/data/www     /srv/www     ext4  defaults,nofail  0  2
/dev/data/backup  /srv/backup  xfs   defaults,nofail  0  0
```

`nofail` lets the server finish booting if a data volume is missing, instead of dropping into emergency mode. Keep it off the root filesystem. Then test the file before the next reboot tests it for you:

```bash
sudo findmnt --verify
sudo systemctl daemon-reload
sudo umount /srv/www /srv/backup && sudo mount -a && df -h /srv/www /srv/backup
```

## Grow a volume

When the volume group has free extents, growing takes one command, with the filesystem mounted:

```bash
sudo lvextend -r -L +500M /dev/data/www     # -r grows the filesystem too
```

If you forget `-r`, the volume grows but the filesystem does not, and `df` shows the old size. Finish the job by hand with `sudo resize2fs /dev/data/www` for ext4, or `sudo xfs_growfs /srv/backup` for XFS, which takes the mount point rather than the device.

When the group is full, add a disk to it, then extend:

```bash
sudo pvcreate /dev/vdc
sudo vgextend data /dev/vdc
```

A disk that itself got bigger needs two more steps first. After a resize to a bigger plan on CloudSat ([resize a server](https://cloudsat.io/docs/resize-a-server)) the virtual disk is larger; check with `lsblk` whether the partition and the physical volume picked up the space, and grow them if not:

```bash
sudo growpart /dev/vda 3      # from cloud-guest-utils (Debian, Ubuntu) or cloud-utils-growpart (RHEL family)
sudo pvresize /dev/vda3
sudo lvextend -r -l +100%FREE /dev/mapper/rootvg-root   # use your own VG and LV names from lvs
```

## Replace a disk without downtime

`pvmove` relocates every extent from one physical volume to the others in the group while the volumes stay mounted. That is how you retire an old disk on a dedicated server or move data to a faster one:

```bash
sudo pvcreate /dev/vdd
sudo vgextend data /dev/vdd
sudo pvmove /dev/vdb            # copies in the background, shows progress
sudo vgreduce data /dev/vdb
sudo pvremove /dev/vdb
```

The group needs enough free space on the remaining disks to hold everything that lived on the one you remove. `pvmove` can be interrupted and resumed, but run it in `tmux` or `screen` so a dropped SSH session does not leave you guessing.

## Thin volumes

A thin pool hands out space only when data is actually written, so you can create volumes larger than the pool and snapshot them cheaply:

```bash
sudo lvcreate --type thin-pool -L 500M -n pool data
sudo lvcreate -V 2G -T data/pool -n projects
sudo lvcreate -s -n projects-snap data/projects   # thin snapshot, no size needed
```

The catch is overcommitment. If the pool fills up, every volume in it stops accepting writes. Watch the `Data%` column of `sudo lvs` and grow the pool with `lvextend` before it reaches the limit.

## Shrink, with a backup first

Only ext4 can shrink, and only unmounted. `lvreduce -r` checks and shrinks the filesystem before the volume, in the right order:

```bash
sudo umount /srv/www
sudo lvreduce -r -L 700M /dev/data/www
sudo mount /srv/www
```

Shrinking the volume without the filesystem, or in the wrong order, cuts off data. For XFS the only route is to back up, recreate the volume smaller and restore.

## Snapshots for consistent backups

A classic LVM snapshot freezes a point-in-time view of a volume, so a backup can read a stable copy while the original keeps changing:

```bash
sudo lvcreate -s -n www-snap -L 300M /dev/data/www
sudo mkdir -p /mnt/snap && sudo mount -o ro /dev/data/www-snap /mnt/snap
sudo tar -czf /srv/backup/www-$(date +%F).tgz -C /mnt/snap .
sudo umount /mnt/snap && sudo lvremove -y data/www-snap
```

The snapshot's size is space for changes made to the original while it exists; when that fills up, the snapshot becomes invalid. Every write to the origin also costs an extra copy, so remove snapshots once the backup is done. To roll the origin back instead, `sudo lvconvert --merge data/www-snap` restores it to the snapshot state; if the origin is in use, the merge happens the next time the volume is activated. For an XFS snapshot, mount with `-o ro,nouuid`, because the copy has the same UUID as the original.

## Reach LVM volumes from a rescue system

When a server will not boot, a rescue environment does not always activate volume groups by itself. Scan and activate them, then mount read-only before you change anything:

```bash
sudo vgscan
sudo vgchange -ay
sudo lvs
sudo mount -o ro /dev/rootvg/root /mnt     # your VG and LV names from lvs
```

If two disks carry the same volume group name, rename one by its UUID with `vgrename`, taken from `vgs -o +vg_uuid`. Disks cloned from the same image also share UUIDs and need `vgimportclone` instead. The [rescue guide](https://cloudsat.io/learn/rescue-files-from-a-vps-that-will-not-boot) covers the rest of a recovery.

## Clean up the practice run

```bash
sudo umount /srv/www /srv/backup
sudo lvremove -y data
sudo vgremove data
sudo pvremove /dev/loop0 /dev/loop1
sudo losetup -d /dev/loop0 /dev/loop1
sudo rm /var/tmp/pv1.img /var/tmp/pv2.img
```

Remove the two practice lines from `/etc/fstab` as well.

## FAQ

### Does LVM slow the disk down?

A plain linear volume adds a mapping lookup that is negligible next to disk latency. The real cost comes from classic snapshots, which double some writes while they exist.

### Is a volume group over two disks a form of redundancy?

No. A linear volume spread over two disks fails if either disk fails. For redundancy, put LVM on top of a RAID array, use `lvcreate --type raid1`, or keep backups on another machine.

### Can I turn an existing partition into LVM in place?

Not safely. Create a new logical volume, copy the data across with `rsync -aHAX`, switch the mount point in `/etc/fstab`, and only then reuse the old partition as a physical volume.

**Run it on CloudSat.** Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. [See plans](https://cloudsat.io/plans) or [deploy a server](https://dash.cloudsat.io/console/deploy).

## Keep reading

[All guides in Linux](https://cloudsat.io/learn/topic/linux)

- [LVM or ZFS on Linux: picking a storage layer for a server](https://cloudsat.io/learn/lvm-or-zfs-for-linux-storage): Linux LVM or ZFS on Linux: picking a storage layer for a server 6 min read
- [Find what is filling your Linux disk with df, du and ncdu](https://cloudsat.io/learn/find-what-is-filling-your-linux-disk): Linux Find what is filling your Linux disk with df, du and ncdu 7 min read
- [Rescue files from a Linux or Windows VPS that will not boot](https://cloudsat.io/learn/rescue-files-from-a-vps-that-will-not-boot): Linux Rescue files from a Linux or Windows VPS that will not boot 6 min read
- [Test disk speed on Linux with fio, and read the results](https://cloudsat.io/learn/benchmark-disk-speed-on-linux-with-fio): Linux Test disk speed on Linux with fio, and read the results 6 min read
