How to Expand a Linux LVM Root Partition Using Additional Storage on Linux | INTROSERV
EUR
european

EUR

usa

USD

English En
Ex. VAT Ex. VAT 0%

How to Expand a Linux LVM Root Partition Using Additional Storage on Linux

Introduction

In this tutorial, you perform LVM disk expansion by extending a Linux Logical Volume Manager (LVM) root partition with additional storage. This method allows you to extend Linux filesystem LVM without reinstalling the system or stopping services. You follow a precise and safe process suitable for production systems where mistakes can result in irreversible data loss.

Prerequisites

Target audience: Beginner system administrators

Estimated time: 30–45 minutes

Operating system: Linux distribution with LVM support (tested on Debian 13)

Required software:

  • lvm2 (2.03.x or later)
  • util-linux (includes lsblk)
  • e2fsprogs (for ext4) or xfsprogs (for XFS)

Hardware requirements:

  • One additional empty disk (for example /dev/sdb)

Permissions:

  • Root or a user with sudo privileges

Network requirements:

  • Not required

Assumed knowledge:

  • Basic command line usage
  • Understanding of disks and partitions

End goal: By the end of this tutorial, you will add disk to LVM and complete LVM volume expansion of your root logical volume using additional storage without downtime.

Info

Important: The cost of error is inestimable. A single incorrect device name can destroy all data on your system. Always verify every command before execution.

Tip

If this is your first time working with LVM, practice these steps in a non-production environment.

Step 1: Verify Current LVM Layout

Run the following commands to inspect your current LVM configuration.

pvs displays information about physical volumes. It shows which disks or partitions are initialized for LVM and how much space is available or used on each physical volume.

sudo pvs

Sample output:

PV VG Fmt Attr PSize PFree /dev/sda5 debian-lvm-vg lvm2 a-- 9.25g 36.00m

vgs displays information about volume groups. It shows the total size of each volume group, how much space is used, and how much free space is available for expansion.

sudo vgs

Sample output:

VG #PV #LV #SN Attr VSize VFree debian-lvm-vg 1 2 0 wz--n- 9.25g 36.00m

lvs displays information about logical volumes. It shows the size, name, and attributes of each logical volume, including the root volume you will expand. You will extend partition using additional disk.

sudo lvs

Sample output:

LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert root debian-lvm-vg -wi-ao---- <8.69g swap_1 debian-lvm-vg -wi-ao---- 544.00m

Expected result:

  • You see your root logical volume, volume group, and physical volumes
  • The root logical volume is typically mounted at /

Step 2: Identify the New Disk

List available disks:

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT

Sample output:

NAME SIZE TYPE MOUNTPOINT sda 10G disk ├─sda1 759M part /boot ├─sda2 1K part └─sda5 9.3G part ├─debian--lvm--vg-root 8.7G lvm / └─debian--lvm--vg-swap_1 544M lvm [SWAP] sdb 5G disk sdc 5G disk sdd 5G disk

Expected result:

  • A new disk such as /dev/sdb appears with no partitions or filesystem

Info

Important: Ensure the disk is correct and empty. All existing data on this disk will be lost.

Step 3: Create a Physical Volume

Initialize the new disk as a physical volume:

sudo pvcreate /dev/sdb

Expected result:

  • Command completes successfully and reports the physical volume creation

Verify:

sudo pvs

This allows you to add new storage to existing LVM.

Step 4: Extend the Volume Group

Add the new physical volume to your existing volume group:

sudo vgextend <VG_NAME> /dev/sdb

Expected result:

  • The volume group size increases and includes the new disk

Verify:

sudo vgs

Sample output:

VG #PV #LV #SN Attr VSize VFree debian-lvm-vg 2 2 0 wz--n- <19.25g 0

The PV column shows that the volume group now includes the new disk.

Step 5: Extend the Root Logical Volume

Extend the root logical volume to use all available free space. To extend logical volume the lvextend command is used:

sudo lvextend -l +100%FREE /dev/<VG_NAME>/root

Expected result:

  • Logical volume size increases successfully

Step 6: Resize the Filesystem

Resize the filesystem to use the additional space.

For ext4:

sudo resize2fs /dev/<VG_NAME>/root

For XFS:

sudo xfs_growfs /

Expected result:

  • Filesystem expands to match the new logical volume size

Step 7: Verify the Expansion

Check the updated filesystem size:

df -h /

Expected result:

  • Root filesystem reflects increased capacity

Confirm LVM state:

sudo lvs

sudo vgs

Verification and Testing

  • The system remains operational without reboot
  • df -h shows increased available space
  • No errors appear in system logs: dmesg | tail

Reverting Changes

Reverting is only possible if no critical data has been written to the new space.

  1. Reduce filesystem usage if applicable
  2. Shrink filesystem if supported
  3. Reduce logical volume: sudo lvreduce /dev/<VG_NAME>/root
  4. Remove disk from volume group: sudo vgreduce <VG_NAME> /dev/sdb
  5. Remove physical volume: sudo pvremove /dev/sdb

Info

Important: Shrinking logical volumes and filesystems is risky and may lead to data loss. Avoid this operation in production unless absolutely necessary.

Troubleshooting

  • Command fails with "device not found": verify disk name using lsblk
  • Volume group shows no free space: confirm vgextend completed successfully
  • Filesystem size did not change: ensure correct tool is used for your filesystem type
  • Permission denied errors: ensure commands are executed with sudo or as root

Conclusion and Next Steps

You successfully learned to expand root filesystem without downtime using LVM by adding a new disk, extending the volume group, and resizing the filesystem without downtime. This method is essential when you need to upgrade server storage capacity in Linux environments.

Next steps:

  • Configure LVM snapshots for backups
  • Monitor disk usage
  • Explore advanced LVM features

VAT

  • Other

    Ex. VAT

    0%
  • austria

    Austria

    20%
  • Belgium

    Belgium

    21%
  • Bulgaria

    Bulgaria

    20%
  • Croatia

    Croatia

    25%
  • Cyprus

    Cyprus

    19%
  • Czech Republic

    Czech Republic

    21%
  • Denmark

    Denmark

    25%
  • Estonia

    Estonia

    22%
  • France

    France

    20%
  • Finland

    Finland

    24%
  • Germany

    Germany

    19%
  • Greece

    Greece

    24%
  • Hungary

    Hungary

    27%
  • Ireland

    Ireland

    23%
  • Italy

    Italy

    22%
  • Latvia

    Latvia

    21%
  • Lithuania

    Lithuania

    21%
  • Luxembourg

    Luxembourg

    17%
  • Malta

    Malta

    18%
  • Netherlands

    Netherlands

    21%
  • Poland

    Poland

    23%
  • Portugal

    Portugal

    23%
  • Romania

    Romania

    19%
  • Slovakia

    Slovakia

    20%
  • Slovenia

    Slovenia

    22%
  • Spain

    Spain

    21%
  • Sweden

    Sweden

    25%
  • USA

    USA

    0%
european
states
  • germany
  • Español
  • Italiano
  • Poland
  • Русский
  • Slovenski
  • Türkçe
  • ukraine
  • kingdom
  • French
  • Hrvatska
  • Other
  • Austria
  • Belgium
  • Bulgaria
  • Croatia
  • Cyprus
  • Czech Republic
  • Denmark
  • Estonia
  • Finland
  • France
  • Germany
  • Greece
  • Hungary
  • Ireland
  • Italy
  • Latvia
  • Lithuania
  • Luxembourg
  • Malta
  • Netherlands
  • Poland
  • Portugal
  • Romania
  • Slovakia
  • Slovenia
  • Spain
  • Sweden
  • USA