News about our company, tutorials about IT and much more you will find in this page.
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.
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
lsblk
, fdisk -l
, or parted -l
): lsblk
Confirm which disks are free and have no partitions you need to keep.
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
sudo pvs
You should see entries for each disk you just initialized.
Now we combine these physical volumes into a single pool (volume group).
sudo vgcreate vg_home /dev/sdb /dev/sdc /dev/sdd
sudo vgs
…to see the newly created vg_home.
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. sudo lvs
…or lsblk to see that /dev/vg_home/lv_home has been created.
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
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
We want our new volume to mount automatically at /home
when the system boots.
/etc/fstab
in a text editor (like nano or vi): sudo nano /etc/fstab
/dev/vg_home/lv_home /home ext4 defaults 0 2
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.
df -h
You should see something like:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_home-lv_home 2T ... ... ... /home
-l 100%FREE
, so they have extra space in the volume group for snapshots, different LVs, etc.lsblk
, df -h
, and lvs
/vgs
/pvs
to keep an eye on usage./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.