Home » How to Resize an LVM Volume in Linux When the Disk Runs Out of Space
Systems & Servers

How to Resize an LVM Volume in Linux When the Disk Runs Out of Space

✨ Quick Answer

The disk full error (No space left on device) on a Linux server using LVM (Logical Volume Manager) can paralyze databases and services. The advantage of LVM is that it allows hot storage expansion, adding physical space to the logical volume and extending the file system without needing a reboot.

Quick Diagnostics

Cause
Logical Volume (LV) full while Volume Group (VG) has free space
Solution
Extend logical volume: lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
Cause
Filesystem not expanded after extending the logical volume
Solution
Resize ext4/xfs filesystem using resize2fs or xfs_growfs

The disk full error (No space left on device) on a Linux server using LVM (Logical Volume Manager) can paralyze databases and services. The advantage of LVM is that it allows hot storage expansion, adding physical space to the logical volume and extending the file system without needing a reboot.

Step-by-Step Solution

  1. 1

    Step 1: Identificar el volumen lógico y el espacio disponible

    First, verify which partition is saturated and locate the path of your logical volume:

    BASH
    # Ver el uso de disco de todas las particiones
    df -h
    
    # Listar los volúmenes lógicos activos
    sudo lvdisplay
    

    (Anota la ruta del volumen que quieres extender, por ejemplo /dev/mapper/vg_system-lv_root).

  2. 2

    Step 2: Escanear el nuevo almacenamiento físico

    If you have expanded the virtual disk in your hypervisor (Proxmox, VMware, KVM), you must tell the Linux kernel to detect the physical disk size change (for example, /dev/sda):

    BASH
    # Forzar un re-escaneo del bus SCSI para detectar la nueva capacidad
    echo 1 | sudo tee /sys/class/block/sda/device/rescan
    
    # Notificar a LVM que el volumen físico ha cambiado de tamaño
    sudo pvresize /dev/sda
    
  3. 3

    Step 3: Extender el volumen lógico y el sistema de archivos

    Once the physical volume recognizes the new space, proceed to expand the logical volume and resize its internal structure in a single step:

    BASH
    # Para sistemas con formato EXT4 (extiende volumen lógico y sistema de archivos simultáneamente)
    sudo lvextend -r -l +100%FREE /dev/mapper/vg_system-lv_root
    
    # Si el sistema de archivos usa XFS, ejecuta la extensión de forma explícita
    sudo lvextend -l +100%FREE /dev/mapper/vg_system-lv_root
    sudo xfs_growfs /
    

Prevention Advice

Recommended security practices:

  • Never reduce the size of an LVM logical volume (lvreduce) hot or without having made a full backup of your database beforehand. While expanding storage is a safe task that executes in milliseconds, volume reduction is highly destructive and can permanently corrupt file descriptors if the assigned logical size falls below the actual volume of your data.
Author • Web Designer & App Creator

Rodolfo Castro

Web designer, app developer, and founder of SoporteCero. Specializing in UI/UX architecture, digital products, and modern web environments. Every tutorial and guide on SoporteCero is thoroughly tested and verified in our technical lab to ensure reliable, up-to-date solutions.