1 min read

How to Resize LVM Logical Volumes in Debian

Resizing Logical Volume Manager (LVM) logical volumes can be a crucial task when managing disk space on your Debian system. This tutorial will guide you through the process of resizing logical volumes, specifically focusing on reducing the size of the home logical volume and increasing the size of the root logical volume.

Prerequisites

Before you begin, ensure you have:

  • Root access to your Debian system.
  • A backup of your important data (resizing volumes can be risky).

Steps to Resize LVM Logical Volumes

1. Log Out and Enter as Root

First, log out of your current session and log in as the root user. This ensures you have the necessary permissions to perform the resizing operations.

2. Reduce the home Logical Volume

To reduce the size of the home logical volume, use the following command:

lvreduce --resizefs -L-100G test-vg/home

This command reduces the home logical volume by 100GB. The --resizefs option ensures that the filesystem is resized along with the logical volume.

3. Increase the root Logical Volume

After reducing the home logical volume, you can increase the size of the root logical volume. Use the following command:

bash

lvresize --resizefs -L+100G test-vg/root

This command increases the root logical volume by 100GB. Again, the --resizefs option ensures that the filesystem is resized accordingly.

Additional Information

Checking Available Space

Before resizing, it's good practice to check the available space in your volume group. You can do this with the following command:

vgdisplay test-vg

This command displays detailed information about the volume group, including the available free space.

Verifying Filesystem Integrity

After resizing, it's important to verify the integrity of the filesystems. You can use the fsck command to check and repair filesystems:

fsck /dev/tset-vg/home
fsck /dev/test-vg/root

Monitoring Disk Usage

To monitor disk usage and ensure that the resizing operations were successful, you can use the df command:

df -h

This command displays the disk usage in a human-readable format.