What do you need help with?

We are here and ready to help.
Email: servicedesk@socfortress.co

How to Expand LVM Disk for /docker-data

How to Expand LVM Disk for /docker-data

This guide outlines the steps required to expand the logical volume and filesystem for /docker-data after additional disk capacity has been added to the underlying physical disk. This mount point is commonly used to store Docker data and persistent volumes.

Prerequisites

  • The disk has already been expanded at the hypervisor or hardware level.
  • The disk is used directly as an LVM physical volume (not partitioned).
  • The mount point /docker-data is backed by an LVM logical volume.
  • The filesystem is ext4 (most common for Docker data volumes).

Step-by-Step Instructions

  1. Identify the Disk and Logical Volume
    First, determine which physical disk and logical volume back /docker-data:
    lsblk

    Example output:

    
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
    sdb 8:16 0 750G 0 disk
    └─vg_docker-lv_docker 254:1 0 500G 0 lvm /docker-data
     

    In this example:

    • /dev/sdb is the physical disk backing the volume group
    • /dev/mapper/vg_docker-lv_docker is the logical volume mounted at /docker-data
  2. Resize the Physical Volume
    Make LVM aware of the newly available space on the expanded disk:
    pvresize /dev/sdb
  3. Extend the Logical Volume
    Expand the logical volume to consume all remaining free space in the volume group:
    lvextend -l +100%FREE /dev/mapper/vg_docker-lv_docker
  4. Resize the ext4 Filesystem
    Grow the ext4 filesystem to use the newly allocated space:
    resize2fs /dev/mapper/vg_docker-lv_docker

Verification

Confirm that the additional space is now available on /docker-data:

df -h /docker-data

Example Output


Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_docker-lv_docker 750G 420G 330G 56% /docker-data

Notes

  • This procedure is safe to perform while Docker and containers are running.
  • No service restart is required when expanding ext4 filesystems online.
  • Always take a snapshot or backup before resizing storage on production systems.
  • Monitor Docker volume growth to avoid excessive disk consumption.
Facebook Share Tweet

Was this article helpfu?

Yes No

Thank you for voting

×
Select company

You are related to multiple companies. Please select the company you wish to login as.