Informational Website publish

Blog

News about our company, tutorials about IT and much more you will find in this page.

How to Combine Multiple Disks into Large Volume and Mount it as /home Using LVM

Janeiro 21st, 2025

In this tutorial, you’ll learn how to use Logical Volume Manager (LVM) to combine multiple disks into a single large volume and mount it as /home. This is a great way to simplify disk management and make use of multiple smaller disks.

In order to Combine Multiple Disks into Large Volume and Mount it Using LVM You Will Need:

  • A Linux system that supports LVM.
  • At least two or more unpartitioned disks or partitions ready to be used.
  • Backup Important Data: If you already have data in /home, back it up to avoid accidental data loss.

1. Install LVM Tools (If Needed)

On some distributions, you might need to install the LVM utilities. For example, on Debian/Ubuntu:

sudo apt-get update
sudo apt-get install lvm2

On CentOS/RHEL:

sudo yum install lvm2

2. Create Physical Volumes

  1. Identify your disks (using lsblk, fdisk -l, or parted -l):
   lsblk

Confirm which disks are free and have no partitions you need to keep.

  1. Create the physical volumes:

Let’s assume your new disks are /dev/sdb, /dev/sdc and /dev/sdd.

   sudo pvcreate /dev/sdb
   sudo pvcreate /dev/sdc
   sudo pvcreate /dev/sdd
  • This tells LVM that /dev/sdb, /dev/sdc and /dev/sdd are now available for use in LVM volume groups.
  1. Verify Volumes:
   sudo pvs

You should see entries for each disk you just initialized.


3. Create a Volume Group

Now we combine these physical volumes into a single pool (volume group).

sudo vgcreate vg_home /dev/sdb /dev/sdc /dev/sdd
  • Here, vg_home is the name of the volume group, you can use any other name for the group.
  • Check with:
  sudo vgs

…to see the newly created vg_home.


4. Create a Logical Volume

Next, we create a logical volume (think of it like a “virtual partition”) inside vg_home.

sudo lvcreate -l 100%FREE -n lv_home vg_home
  • -l 100%FREE means “use all the free space in this volume group”, you can choose partions of your disk, like, 10GB, 50GB, just change 100%FREE by the amount you want.
  • -n lv_home is the name of the logical volume.
  • Check with:
  sudo lvs

…or lsblk to see that /dev/vg_home/lv_home has been created.


5. Format the Logical Volume

Format the new logical volume with your preferred filesystem. Let’s use ext4:

sudo mkfs.ext4 /dev/vg_home/lv_home

Note: If you prefer XFS or another filesystem, change the command accordingly. For XFS:

sudo mkfs.xfs /dev/vg_home/lv_home

6. Mount the Logical Volume

Now, that we have the logical volume and file system, we can mount it to a directory, such as /home.

sudo mount /dev/vg_home/lv_home /home

7. Add an Entry to /etc/fstab

We want our new volume to mount automatically at /home when the system boots.

  1. Open /etc/fstab in a text editor (like nano or vi):
   sudo nano /etc/fstab
  1. Add the line below at the end (adjust if you use a different filesystem):
   /dev/vg_home/lv_home    /home    ext4    defaults    0 2
  1. Save and exit the editor.

Alternatively, you can use:

echo "/dev/vg_home/lv_home /home ext4 defaults 0 2" | sudo tee -a /etc/fstab

…which appends the line automatically.


Verification

  • Run:
  df -h

You should see something like:

  Filesystem                  Size  Used Avail Use% Mounted on
  /dev/mapper/vg_home-lv_home   2T   ...   ...   ... /home
  • Reboot to ensure it all works automatically.

Final Tips & Best Practices

  • Leave Some Free Space? Some admins prefer to not use -l 100%FREE, so they have extra space in the volume group for snapshots, different LVs, etc.
  • Snapshots: LVM supports snapshots which can be helpful for backups.
  • Monitoring: Use lsblk, df -h, and lvs/vgs/pvs to keep an eye on usage.
  • Backup, Backup, Backup: Always have a backup strategy—especially for important directories like /home.

That’s it! You’ve now combined multiple disks into a single large logical volume and moved your /home directory to it. Feel free to ask questions or share your success stories in the comments.

If you encounter any issues or have questions, feel free to ask for help using our method of contact.

If you are interested in learning how to setup ipv4 in ubuntu24.04.