LVM (Logical Volume Manager) is a software that allows you to manage multiple hard drive spaces by creating logical volumes. With LVM you can create, grow and shrink partitions according to your needs. LVM is composed of three components: physical volume, volume group, and logical volume. Each volume group is made up of physical volumes. You can expand or shrink a volume group by adding or deleting physical volumes.

LVM Benefits

  • If you have multiple hard drives, through LVM you can group all hard drives into one large drive.
  • You can create and resize new partitions as needed.
  • You can add an additional hard drive to a current volume group to increase space.

Note: This tutorial assumes that you are using Ubuntu and have three hard drives (/dev/sda, /dev/sdb and /dev/sdc).

Create partition in /dev/sdb and /dev/sdc

First you need two unpartitioned hard drives “/dev/sdb” and “/dev/sdc”. You need to create a physical volume on this hard drive and you need to create a partition on each hard drive for this.

To create a partition on “/dev/sdb”, run:

Answer all the questions below.

Repeat the same process for /dev/sdc.

To read the partition table again without rebooting, run the following commands:

sudo partprobe /dev/sdb sudo partprobe /dev/sdc

Create the physical volumes

A physical hard drive is divided into one or more physical volumes. Here we will create a single physical volume on each hard drive.

To create the physical volume on “/dev/sdb1” and “/dev/sdc1”, run

sudo pvcreate /dev/sdb1 /dev/sdc1

Something like this will come out.

Create the volume group

A combination of one or more physical volumes is called a volume group. You can use the SamaGamereate command to create a volume group from one or more physical volumes.

To create volume group “VG1” on a physical volume (/dev/sdb1 and /dev/sdc1), run the following command:

sudo SamaGamereate VG1 /dev/sdb1 /dev/sdc1

The output is something like this.

To verify the volume group, run

and his departure.

We now have a single 19.52 GB volume group (VG1).

Create the logical volume

Volume groups can be divided into logical volumes and assigned mount points. When the size of the logical volumes is full, you can add the required free space from the volume group.

Now create the logical volume (LV1 and LV2) of 5 GB size.

sudo lvcreate VG1 -L +5G -n LV1 sudo lvcreate VG1 -L +5G -n LV2

Change “VG1” to the name of the volume group. The -L flag specifies the size of the partition, while the -n flag specifies the name of the logical volume.

To verify the logical volume, run

and his departure.

Finally, we have successfully created a 5GB LVM partition.

Format and mount LVM partition (LV1, LV2)

To use logical volumes, we must first format them. We can format the LVM partition using ext4 file system with the following command:

sudo mkfs.ext4 /dev/VG1/LV1 sudo mkfs.ext4 /dev/VG1/LV2

Create a directory at “/mnt” for a mount partition.

sudo mkdir /mnt/LV1-mount /mnt/LV2-mount

Mount the LVM partition by editing the “/etc/fstab” file.

Add the following line:

/dev/VG1/LV1 /mnt/LV1-mount ext4 defaults 0 0 /dev/VG1/LV2 /mnt/LV2-mount ext4 defaults 0 0

For the changes to take effect without rebooting the system, run

To verify assembly:

Something like this will come out.

Resize logical volumes

One of the benefits of LVM is to extend or reduce the size of partitions. We can resize logical volumes on the fly without restarting the server. We can easily extend/shrink logical volumes using lvextend/resize2fs commands

Expand logical volume

In some situations, we need to expand the size of a low space partition. We can easily expand any partition using the lvextend domain. We can extend logical volumes only if the volume group has enough free space.

To expand logical volume LV1 from 5 GB to 6 GB, run

sudo lvextend -L+1G /dev/VG1/LV1

The logical volume is 6 GB, but the file system on that volume is still only 5 GB.

To have the file system use the available 6 GB, run

sudo resize2fs /dev/VG1/LV1

The output is something like this.

Reduce logical volume

Reducing logical volume is a more interesting part of logical volume management than any other part. Before shrinking the logical volume, it is good to backup the data.

You must perform the following steps to reduce logical volumes.

First, to unmount logical volume LV2, run

Then check the file system error using the following command:

sudo e2fsck -f /dev/VG1/LV2

Next, reduce the LV2 logical volume from 5 GB to 4 GB by running

sudo resize2fs -p /dev/VG1/LV2 4G sudo e2fsck -f /dev/VG1/LV2

Remount the file system to the mount point.

sudo mount /dev/VG1/LV2 /mnt/LV2-mount

Check the new logical volume size by running

The output is something like this.

Delete logical volume

To delete a logical volume, you must unmount it before you can delete it.

To delete an LV1 logical volume, run

sudo umount /dev/VG1/LV1 sudo lvremove /dev/VG1/LV1


I have tried to explain each topic briefly. You can set up a virtual lab environment and try out what you can do with LVM. If you have any questions, feel free to comment below.

Ubuntu 10.10 discussed in the Ubuntu Developer Summit

Ubuntu 10.04 with Wubi Ubuntu Installer

Ubuntu 10.04 Lucid Lynx and the graphical environment

Ubuntu 10.04 and Windows 7

What it is and how to use the new Ubuntu 16.04 Snap packaging system

Ubuntu 10.10 and the Design challenge

How to turn your Ubuntu personal computer into a LAMP web server

Ubuntu 10.04 Lucid Lynx download

Ubuntu One now also for Windows

Ubuntu 10.04 vs Fedora 13

Ubuntu 10.10

5 interesting features coming to Ubuntu 10.10

How to use Rufus to create a bootable Ubuntu USB in Windows 10

Ubuntu 10.10 Beta Marverick Meerkat finally arrived

Ubuntu 10.10 second release ready

UBUNTU 10.10 RC ready for launch

How to change the position of the taskbar in Ubuntu 16.04 LTS

Ubuntu extends system on Smartphone

Ubuntu 10.10 very user friendly

Ubuntu 10.10 “Maverick Meerkat” released

About the Author

Martin Jenkins

iOS Systems Expert.

dedicated individual with a profound passion for technology and gaming. He pursued his studies in Computer Engineering at Montgomery, honing his technical skills and knowledge. From his early education at Dollard College, where he completed his VMBO, to the present day, Martin has been immersed in the captivating world of gaming since 1992. Embracing his passion, he has embarked on a freelance career as a technology and gaming writer and editor. Through his insightful content, Martin shares his expertise and experiences with others, offering a unique perspective on the ever-evolving landscape of technology. His unwavering dedication fuels his pursuit of staying at the forefront of the digital realm.

View All Articles