Shrink an LVM Volume Without Losing the Filesystem

Run lvreduce before shrinking the filesystem inside it and the command will happily cut away live data. The order that matters is filesystem first, logical volume second, and it is not reversible by the command itself.

1. Confirm the installed command

This is a read-only checkpoint. The local system has LVM Tools 2.03.16(2), supplied by package lvm2 version 2.03.16-3ubuntu3.2. Check your own command before relying on option details:

$ lvreduce --version
  LVM version:     2.03.16(2) (2022-05-18)
$ lvreduce --help

The command accepts either a new size with --size, or a logical extent count with --extents. A leading minus sign makes the value relative, so -l -3 removes three logical extents from the current size; an unprefixed value is an absolute new size.

2. Identify the filesystem and mount state

Do not assume the LV name tells you which filesystem is inside it. These ordinary inspection commands do not need root if the device metadata is readable:

$ findmnt --source /dev/mapper/VG_NAME-LV_NAME --output SOURCE,FSTYPE,TARGET
$ sudo lvs --options lv_name,vg_name,lv_size,lv_attr
$ df -hT /mount/point

Record the filesystem type, current size and mount point. If the LV is mounted, plan downtime unless your filesystem and resize tool explicitly support the operation online. A filesystem must never extend beyond the LV that contains it.

Checkpoint: stop here if the source path, filesystem type or mount point is unclear. Resolve the mapping before issuing any resize command.

3. Take a backup and make the target explicit

Reducing storage is destructive. Copy important data to a separate, tested destination before continuing. An LVM metadata backup is useful for recovering the volume layout, but it does not restore file contents:

$ sudo vgcfgbackup VG_NAME
$ sudo lvs --options lv_name,vg_name,lv_size,segtype,lv_attr VG_NAME

Choose a target that is comfortably larger than the filesystem's used data, not merely the current output of df. Leave room for filesystem metadata and future growth. The final LV size must also be representable as whole logical extents, so LVM may round a requested size.

4. Stop access to the filesystem

Before shrinking, stop services that write to the mount and unmount it. This example is privileged and intentionally fails if something still has the mount open:

$ sudo systemctl stop SERVICE_NAME
$ sudo umount /mount/point
$ findmnt /mount/point

No output from the final command is the result you want. Find the remaining users with sudo fuser -vm /mount/point or sudo lsof +f -- /mount/point. Do not kill processes blindly, and if the LV holds a service database, follow that service's own backup and shutdown procedure first.

5. Shrink the filesystem first

The exact command depends on the filesystem. For ext4, check it while unmounted, then reduce it to a deliberately chosen size. The size syntax accepted by resize2fs is filesystem-specific, so verify its local manual before substituting another filesystem:

$ sudo e2fsck -f /dev/mapper/VG_NAME-LV_NAME
$ sudo resize2fs /dev/mapper/VG_NAME-LV_NAME TARGET_SIZE
$ sudo e2fsck -f /dev/mapper/VG_NAME-LV_NAME

Replace TARGET_SIZE with a value such as 80G only after checking the ext4 tool's requirements and your measured usage. Do not use these commands for XFS: XFS cannot be shrunk in place, so its recovery path is to create a smaller filesystem, copy the data, and switch mounts after verification. Other filesystem types have their own rules.

Tip: as an alternative, lvreduce --resizefs asks LVM to resize the underlying filesystem using fsadm. Use it only when fsadm supports your filesystem and you have verified its plan for this host. It does not remove the need for a backup or a maintenance window.

6. Preview and reduce the LV

Run LVM's test mode first. It disables metadata writing, although the manual warns that multi-stage operations can produce unusual messages because later stages cannot read changes that were not made:

$ sudo lvreduce --test --size 80G VG_NAME/LV_NAME

Review every warning. If the preview is acceptable, perform the change with automatic metadata backup enabled. This is the irreversible storage step:

$ sudo lvreduce --autobackup y --size 80G VG_NAME/LV_NAME

Warning: expect an interactive confirmation unless the command can establish the operation is safe. Do not add --force or --yes merely to make a script continue. --force overrides protections, while --yes answers prompts affirmatively, and both can turn a mistaken device name into data loss.

7. Verify the new boundary before remounting

Check the LV size and filesystem independently:

$ sudo lvs --options lv_name,vg_name,lv_size,lv_attr VG_NAME/LV_NAME
$ sudo e2fsck -f /dev/mapper/VG_NAME-LV_NAME
$ sudo mount /dev/mapper/VG_NAME-LV_NAME /mount/point
$ df -hT /mount/point

The LV report should show the requested size, subject to extent rounding. The filesystem check should complete without reporting that the filesystem is larger than the device. After mounting, inspect the service and logs, then start the service again:

$ sudo systemctl start SERVICE_NAME
$ sudo systemctl --no-pager --full status SERVICE_NAME

Common traps

Done means