How to Extend Logical Volumes on Ubuntu Server

Hi everybody, at the moment on this article, we are going to present you how to prolong logical volumes on Ubuntu Server. You are a sysadmin who created a one-time Linux Distros machine to your wanted software and now has no extra disk area. You initially booted a digital machine, put in a latest Ubuntu operating system, and pressed Next, Finish through the set up wizard. Linux shouldn’t be your bread and butter; you normally cope with Windows and simply want to get it achieved. So, with out additional ado, let’s get began.

Running out of disk area and managing disk partitions has lengthy been an issue for pc engineers. Fortunately, Linux tries to remedy this downside through the use of logical volumes. On Ubuntu Server, logical volumes are the default methodology of managing server disk area. Unfortunately, when utilizing these volumes, not all of the disk area is used, and chances are you’ll marvel the place all of the disk area went. Let’s see how to regulate or improve LVM disk area on Ubuntu.

How to Extend Logical Volumes on Ubuntu Server

Step 1. Collect details about present LVM settings and names

  • To discover out the bodily volumes (PVs) utilized by the LVM file system, run this command:

sudo pvs

  • Now you want to discover out the identify of the quantity group. To do that, sort this command:

sudo vgdisplay

  • Next, the next command will likely be executed to acquire logical quantity data:

sudo lvdisplay

  • As within the earlier instance, the next helpful data ought to be famous:
  • Our server has a quantity group referred to as “ubuntu-vg”, which has a logical quantity “ubuntu-lv”. With this data, we are able to proceed to disk extension.

Step 2. Create new Physical Volume (PV)

  • Whether Ubuntu 20.04 is a digital machine or put in on a Bare-metal devoted server, you want to join/insert the brand new disk (digital or bodily). Once that is achieved, you want to configure it throughout the current LVM file system.
  • Type the next command to determine the newly related disk:

sudo fdisk -l

  • Our preliminary bodily quantity known as /dev/vda (20GiB) and our newly related disk (25 GiB) known as /dev/vdb.
  • Another helpful command to determine the LVM disk on the server is the next:

sudo lvmdiskscan

  • Now we’re prepared to create the brand new disk as a bodily quantity on the server:

sudo pvcreate /dev/vdb

Step 3. Add the brand new Physical Volume (PV) to our Existing Logical Volume (LV)

  • We will add our new PV (/dev/vdb) to the prevailing logical quantity. From the primary instructions on this tutorial, we famous “ubuntu-lv” because the identify of the logical quantity, and

“ubuntu-vg” as the quantity group identify.

sudo vgextend ubuntu-vg /dev/vdb

    • Output: Volume group “ubuntu-vg” efficiently prolonged.
  • Now we want to prolonged the Logical quantity as follows:

sudo lvm lvextend -l +100percentFREE /dev/ubuntu-vg/ubuntu-lv

  • The LVM disk has been efficiently prolonged. One final command is required for the output of “df -h” to present the right file system dimension:

sudo resize2fs -p /dev/mapper/ubuntu–vg-ubuntu–lv

  • That’s it! We have demonstrated how one can simply prolong the LVM file system on your Ubuntu 20.04 server.

Final Words

We hope you loved our article on How to prolong logical volumes on Ubuntu Server. Previously we’ve seen how to create a versatile disk cupboard space utilizing LVM. Here we are going to see how to prolong a quantity group, and prolong and cut back a logical quantity. You can cut back or prolong partitions in logical quantity administration (LVM), additionally referred to as a versatile quantity file system. If you appreciated our article, please share it with others.

I hope you perceive this text, How to Extend Logical Volumes on Ubuntu Server.

Related Posts