Create new LVM Disk on Ubuntu 17.04

This tutorial is going to show you how to create and manage LVM disk on Ubuntu 17.04. LVM (Logical Volume Management) is a powerful disk management system that provide a robust, easy expandable disks in the future. We can easily shrink or extend existing volume when using LVM scheme. By default, Ubuntu 17.04 does not support LVM so we need to install a package called lvm2. This package will be installed by default if we use the LVM scheme during Ubuntu 17.04 installation.

 

What you will learn on this tutorial

  • Create new Physical Volume (PV)
  • Create new Volume Group (VG)
  • Create new Logical Volume (LG)

Steps to create new LVM disks on Ubuntu 17.04

Before we can use LVM, we need to install lvm2 package first. If you have this package already, you can skip it.

Step 1. Install LVM2 package

Step 2. Prepare the disks

On this example, I have added 2 more disks to my existing Ubuntu system. I will create new Volume Group with these two disks. First, we need to check the current disk layout.

As you can see, the current system already have a LVM layout (vda) and you can see also there are two disks (vdb and vdc) available.

Create New Physical Volumes

First, we need to create physical volume on our disk or partition. Since I want to use the entire disk, I don’t have to create partition first. We can directly create new physical volume on both disks.

See all physical volumes on our system using pvdisplay command

Create new VolumeGroup

Now lets create a new Volume Group with the /dev/sdb disk first.

The command above create a new VolGroup called manjaro_lvm with /dev/vdb disk. Off course you can modify that with your own settings. Now we can see our new VG using vgdisplay command.

Create New Logical Volume

Now we can create new Logical Volume. For example, this command will create new LV called manjaro_lv01 inside the Volume Group manjaro_lvm created earlier.

Format Logical Volume

Before we can use the new logical volume to store data, we need to format it. For example, I will format the manjaro_lv01 in ext4 filesystem.

Example

Mount the new volume

At this point, we’ve learned how to create new physical volume, volume group, logical volume. Stay tuned on this blog. Next I will post about how to extend the size of Volume Group and Logical Volume.

1 Trackback / Pingback

  1. How to add new disk to existing Volume Group - Manjaro dot site

Leave a Reply

Your email address will not be published.


*