Resize an LVM volume on Ubuntu without rebooting

Googled777 avatar   
Googled777
This tutorial shows how to extend a logical volume on Ubuntu and grow the filesystem online, without rebooting and without stopping services. It assumes:

You are using LVM (Ubuntu’s default “Use LV..


Resize a Volume on Ubuntu Without Rebooting (LVM)

Resize an LVM volume on Ubuntu without rebooting

This tutorial shows how to extend a logical volume on Ubuntu and grow the filesystem online, without rebooting and without stopping services. It assumes:

  • You are using LVM (Ubuntu’s default “Use LVM” install option).
  • You want to grow (extend) a volume, not shrink it.
  • You have free space in the volume group (either unused disk, or an additional disk added to the VG).
Danger zone: you are modifying storage live. Always have backups, snapshots (VM/hypervisor/LVM), and a tested rollback path. Do not proceed on a production system without a safety plan.
Terminology cheat sheet:
PV (Physical Volume) → disk or partition used by LVM, e.g. /dev/sda3
VG (Volume Group) → pool of space made from PVs, e.g. ubuntu-vg
LV (Logical Volume) → the “partition” the filesystem sits on, e.g. /dev/ubuntu-vg/ubuntu-lv

1. Identify what you are about to resize

1.1. Check current filesystem usage

Use df to see which filesystem and mountpoint you want to extend:

df -h
# or focus on root:
df -h /

Look at the Filesystem and Mounted on columns. On a typical LVM Ubuntu install this will look like:

Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv   98G   26G   68G  28% /
/dev/sda2                          2.0G  243M  1.6G  14% /boot

In this example, the root filesystem is on /dev/mapper/ubuntu--vg-ubuntu--lv, which maps to /dev/ubuntu-vg/ubuntu-lv. This is the LV we’ll extend.

1.2. Confirm it’s LVM and find the LV name

List block devices and LVM relationships:

lsblk

On a typical setup you’ll see something like:

NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda                           8:0    0     2T  0 disk
├─sda1                        8:1    0     1G  0 part /boot/efi
├─sda2                        8:2    0     2G  0 part /boot
└─sda3                        8:3    0     2T  0 part
  └─ubuntu--vg-ubuntu--lv   253:0    0    100G 0 lvm  /

Here:

  • VG: ubuntu-vg
  • LV: ubuntu-lv
  • PV backing the VG: /dev/sda3, size 2T

2. Verify there is free space to extend into

2.1. Check volume group free space

Use vgs (or vgdisplay) to see how much free space is available in the VG:

sudo vgs
# or for more detail
sudo vgdisplay ubuntu-vg

Example output (simplified):

  VG        #PV #LV #SN Attr   VSize   VFree
  ubuntu-vg   1   1   0 wz--n-  2.00t  1.90t

The important field is VFree. If you see a non-zero value (for example 1.90t), you can extend the LV directly from that free space, without touching partitions.

If VFree = 0: you must first add space to the VG:
  1. In a VM: grow the virtual disk, then expand the partition (e.g. /dev/sda3) with fdisk/parted, then run pvresize.
  2. On bare metal: add another disk, create an LVM PV on it, and add it to the VG with vgextend.
Once the VG has free space, continue with the steps below.

2.2. (If needed) Grow the PV after enlarging a partition

If you extended a partition that is already an LVM PV (for example, you enlarged /dev/sda3 in your hypervisor and then with fdisk), you must tell LVM about the new free space:

sudo pvresize /dev/sda3

After this, run vgs again to confirm that VFree increased. Now the VG is ready to donate space to the logical volume.


3. Decide how much to extend

You can extend by an absolute size (e.g. +50G) or “consume all free space”. Using -l +100%FREE is common in simple setups.

GoalExample command pattern
Use all VG free spacelvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
Add a fixed size (e.g. 50G)lvextend -L +50G /dev/ubuntu-vg/ubuntu-lv
Grow LV to exact size (e.g. 500G)lvextend -L 500G /dev/ubuntu-vg/ubuntu-lv

In most Ubuntu server cases, extending the root LV to fill all remaining VG space is exactly what you want for a single-disk system.


4. Extend the logical volume online

Once you know the LV path and how much you want to add, extend it. For the default Ubuntu root LV:

# Show LVs for confirmation
sudo lvs

# Example: extend root LV to use all remaining free space
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

This command only changes the LV size (block device). The filesystem still “thinks” it has the old size, so the next step is to grow the filesystem itself. The LV extension is done live and does not require a reboot.

Double-check the LV path. Extending the wrong LV (for example a database LV you didn’t plan to touch) can have side effects. Always confirm with lvs / lsblk first.

5. Grow the filesystem without rebooting

The exact command depends on the filesystem type. Ubuntu commonly uses ext4, but xfs is also used, especially in some tuned setups.

5.1. Detect filesystem type

Use mount or lsblk to see the filesystem type:

mount | grep "^/dev"
/dev/mapper/ubuntu--vg-ubuntu--lv on / type ext4 (rw,relatime,errors=remount-ro)
# or
lsblk -f

Note the TYPE column from lsblk -f or the type field from mount for your LV (usually /).

5.2. If the filesystem is ext4

ext4 can be grown online while still mounted, as long as the underlying block device (LV) has already been extended. Run:

# Replace with your LV device if different
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv

resize2fs will automatically detect the new LV size and grow the filesystem to fill it. This works on a live system.

5.3. If the filesystem is XFS

xfs is designed to be grown while mounted. Use xfs_growfs with the mount point:

# For XFS, target the mount point, not the device
sudo xfs_growfs /

XFS requires the filesystem to be mounted while growing, and it will extend to fill the new LV size.

Do not use the wrong tool. Using resize2fs on XFS, or xfs_growfs on ext4, will fail and in worst cases may damage data. Always confirm filesystem type before running the resize command.

6. Verify the new size

Once the LV and filesystem have been extended, confirm the result with df and lsblk:

df -h /
lsblk

Example of a successful resize:

Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv  1.9T   26G  1.8T   2% /

NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda                           8:0    0     2T  0 disk
└─sda3                        8:3    0     2T  0 part
  └─ubuntu--vg-ubuntu--lv   253:0    0     2T  0 lvm  /

At this point, the system is still running, services are alive, and you have more usable space on the volume, with no reboot required.


7. Quick reference: end-to-end command sequence

This is a condensed sequence for the common case: single LVM-backed root filesystem, VG already has free space, filesystem is ext4. Run line by line, checking output at each step.

# 1. Inspect current layout
df -h /
lsblk
sudo vgs

# 2. (Optional) If you've enlarged the underlying partition for the PV:
# sudo pvresize /dev/sda3

# 3. Extend the logical volume to use all free space in the VG
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

# 4. Grow the ext4 filesystem online
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv

# 5. Verify
df -h /
lsblk

Production hygiene tips
  • Snapshot first: if you’re on a VM platform, take a VM-level snapshot before the operation.
  • Document: capture lsblk, vgs, and lvs output before and after for your change log.
  • Monitor: watch syslog/journal and app logs while you resize, especially on heavily loaded servers.
0 Comments

No comments found