This guide documents the process of safely deleting obsolete Logical Volumes (LVs) that contained backups, freeing up the space within the Volume Group (VG), and reallocating a physical disk to a separate Volume Group to expand the main root filesystem.
Prerequisites:
- Your system uses Linux Logical Volume Management (LVM).
- You have already manually deleted all files within the backup Logical Volume (
lv_backups). - You have root or
sudoaccess to a terminal. - The exact disk names (
/dev/sdb1,/dev/nvme0n1p1,vg_data,vgmint) must be adjusted to match your system’s output.
Step 1: Verify the Current LVM Configuration and Mount Status
Before making changes, confirm the layout of your physical volumes (PVs), volume groups (VGs), and logical volumes (LVs).
bash
Display physical volumes, volume groups, and free space
sudo pvs
Display logical volumes and their mount points (check mount points)
df -h
Expected Output Example (yours will vary):
Notice which PVs belong to which VG (vg_data and vgmint) and the PFree column.
PV VG Fmt Attr PSize PFree
/dev/nvme0n1p1 vg_data lvm2 a-- <465.76g <465.76g
/dev/sdb1 vg_data lvm2 a-- <931.51g <931.51g
/dev/sda1 vgmint lvm2 a-- <931.51g 0
… other drives listed …
Step 2: Unmount and Remove the Empty Backup Logical Volume
We assume the backup volume was mounted at /mnt/data_backups and named lv_backups in the vg_data volume group.
bash
1. Unmount the logical volume cleanly
sudo umount /mnt/data_backups
2. Permanently remove the logical volume container
Replace vg_data/lv_backups with your actual VG name and LV name
sudo lvremove /dev/vg_data/lv_backups
Type y and press Enter when prompted to confirm the deletion.
Step 3: Verify Free Space
Run sudo pvs again. The space previously used by lv_backups is now marked as PFree within the vg_data volume group.
bash
sudo pvs
Output Example:
Now /dev/nvme0n1p1 and /dev/sdb1 show free space.
PV VG Fmt Attr PSize PFree
/dev/nvme0n1p1 vg_data lvm2 a-- <465.76g <465.76g
/dev/sdb1 vg_data lvm2 a-- <931.51g <931.51g
Step 4: Move a Physical Disk to the Destination Volume Group
To add space to your root partition (which is in a separate VG named vgmint), you must dedicate an entire physical disk to that volume group. We will use the now-empty /dev/sdb1 (931 GB).
bash
1. Remove the PV from the source VG (vg_data)
sudo vgreduce vg_data /dev/sdb1
2. Zero the LVM metadata signature on the disk so it can join a new VG
sudo pvremove /dev/sdb1
3. Re-format the partition as an LVM Physical Volume
sudo pvcreate /dev/sdb1
4. Add the prepared PV to the destination VG (vgmint, which manages your root LV)
sudo vgextend vgmint /dev/sdb1
Step 5: Verify the Disk is Now in the Destination VG
Run
sudo pvs` one last time.
bash
sudo pvs
Output Example:
/dev/sdb1 is now listed under vgmint and shows 100% free space within that new VG.
PV VG Fmt Attr PSize PFree
/dev/sdb1 vgmint lvm2 a-- <931.51g <931.51g
# ...
Step 6: Expand the Root Logical Volume and Filesystem
The space is now available within vgmint. Use lvextend to consume all free space and resize2fs to instantly grow the filesystem.
bash
1. Extend the root LV to use all available free space in the vgmint VG
sudo lvextend -l +100%FREE /dev/vgmint/root
2. Resize the filesystem (assuming ext4) while it is live-mounted
sudo resize2fs /dev/vgmint/root
Step 7: Final Verification
Check your available disk space using df -h /. Your root filesystem size should reflect the new, combined capacity.
bash
df -h /
Final Output Example:
bash
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgmint-root 3.2T 353G 2.7T 12% /
We have successfully reclaimed your space and expanded your root partition without data loss.
twzzler@twzzler:~$
sudo lvs -o +devices
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
lv_backups vg_data -wi-ao---- <1.40t /dev/sdb1(0)
lv_backups vg_data -wi-ao---- <1.40t /dev/nvme0n1p1(0)
lv_backups vg_data -wi-ao---- <1.40t /dev/sdd1(23678)
lv_media vg_data -wi-ao---- <4.97t /dev/sdc1(0)
lv_media vg_data -wi-ao---- <4.97t /dev/sdd1(0)
lv_media vg_data -wi-ao---- <4.97t /dev/sdd1(32444)
lv_media vg_data -wi-ao---- <4.97t /dev/sdf(0)
root vgmint -wi-ao---- <2.25t /dev/nvme1n1p2(0)
root vgmint -wi-ao---- <2.25t /dev/sde1(0)
root vgmint -wi-ao---- <2.25t /dev/sda1(0)
swap_1 vgmint -wi-ao---- 1.91g /dev/nvme1n1p2(121479)
twzzler@twzzler:~$ `
sudo umount /mnt/data_backups`
twzzler@twzzler:~$ `
sudo lvremove /dev/vg_data/lv_backups
`
Do you really want to remove and DISCARD active logical volume vg_data/lv_backups? [y/n]: y
Logical volume “lv_backups” successfully removed.
twzzler@twzzler:~$
sudo umount /mnt/data_backups
umount: /mnt/data_backups: not mounted.
twzzler@twzzler:~$
sudo lvremove /dev/vg_data/lv_backups
Failed to find logical volume “vg_data/lv_backups” (I manually remove before hand)
twzzler@twzzler:~$
sudo pvs
PV VG Fmt Attr PSize PFree
/dev/nvme0n1p1 vg_data lvm2 a-- <465.76g <465.76g
/dev/nvme1n1p2 vgmint lvm2 a-- <476.44g 0
/dev/sda1 vgmint lvm2 a-- <931.51g 0
/dev/sdb1 vg_data lvm2 a-- <931.51g <931.51g
/dev/sdc1 vg_data lvm2 a-- <931.51g 0
/dev/sdd1 vg_data lvm2 a-- <465.76g 34.24g
/dev/sde1 vgmint lvm2 a-- 894.25g 0
/dev/sdf vg_data lvm2 a-- <3.64t 0
twzzler@twzzler:~$
sudo vgreduce vg_data /dev/sdb1
Removed “/dev/sdb1” from volume group “vg_data”
twzzler@twzzler:~$
sudo pvremove /dev/sdb1
Labels on physical volume “/dev/sdb1” successfully wiped.
twzzler@twzzler:~$
sudo pvcreate /dev/sdb1
Physical volume “/dev/sdb1” successfully created.
twzzler@twzzler:~$
sudo vgextend vgmint /dev/sdb1
Volume group “vgmint” successfully extended
twzzler@twzzler:~$
sudo pvs
PV VG Fmt Attr PSize PFree
/dev/nvme0n1p1 vg_data lvm2 a-- <465.76g <465.76g
/dev/nvme1n1p2 vgmint lvm2 a-- <476.44g 0
/dev/sda1 vgmint lvm2 a-- <931.51g 0
/dev/sdb1 vgmint lvm2 a-- <931.51g <931.51g
/dev/sdc1 vg_data lvm2 a-- <931.51g 0
/dev/sdd1 vg_data lvm2 a-- <465.76g 34.24g
/dev/sde1 vgmint lvm2 a-- 894.25g 0
/dev/sdf vg_data lvm2 a-- <3.64t 0
twzzler@twzzler:~$
sudo lvextend -l +100%FREE /dev/vgmint/root
Size of logical volume vgmint/root changed from <2.25 TiB (588873 extents) to <3.16 TiB (827339 extents).
Logical volume vgmint/root successfully resized.
twzzler@twzzler:~$
sudo resize2fs /dev/vgmint/root
resize2fs 1.47.0 (5-Feb-2023)
Filesystem at /dev/vgmint/root is mounted on /; on-line resizing required
old_desc_blocks = 288, new_desc_blocks = 404
The filesystem on /dev/vgmint/root is now 847195136 (4k) blocks long.
twzzler@twzzler:~$
df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgmint-root 3.2T 353G 2.7T 12% /
twzzler@twzzler:~$