- Create a new Ubuntu Server instance and install the LVM2 driver.
- Add an existing storage device to the LVM2 pool and enable it to be used as a logical volume:
- Create a new user account for the storage device and add it to the LVM2 pool:
- Add the storage device to the LVM2 pool:
- Configure your system so that it uses LVM2:
- Add your storage devices to the LVM2 pool:
Ways to Extend Logical Volumes on Ubuntu Server
Collect information about current LVM settings and names
lvm pv show
The output will show the physical volumes (PV) used by the LVM file system. ..
grep -v “Volume group name” /etc/sysconfig/network/ifcfg-eth0 This will give you the Volume group name.
lsv This will list all the logical volumes on the system.
In order to expand our disk on our Ubuntu server, we must first identify the Volume Group that contains the Ubuntu-lv Logical Volume. This information can be found by using the “grep -F ‘ubuntu-vg’ /etc/fstab” command. Once we have identified the Volume Group, we can use the “md” command to create a new Logical Volume for Ubuntu.
Create new Physical Volume (PV)
Ubuntu 20.04 installation on a dedicated server:
- attach the new disc to the Ubuntu 20.04 installation
- configure the LVM file system to store the disc
- reboot
diskutil list The output will show you the disk type and the number of cylinders.
ls -l /dev/sda
We have created a new disk as Physical Volume on the server.
Add the new Physical Volume (PV) to our Existing Logical Volume (LV)
We will not upgrade our current logical volume by adding our new PV (/dev/vdb). We have noted “ubuntu-lv” as the logical volume name and “ubuntu-vg” as the volume group name from the first commands in this tutorial.
Logical Volume (L1) Extended Logical Volume (E1) The extended logical volume will hold the data that was not included in the original logical volume.
df -h
Filesystem size Used Avail Use% Mounted on /dev/sda1 2.6G 1.8G 97% / /dev/sdb1 8.8G 2M 97% /boot
In this tutorial, we will show you how to extend the LVM file system on your Ubuntu 20.04 Server. This will allow you to create more storage space and improve performance. ..
Final Words
To maximize the use of your disc space, you should create logical volumes on your Ubuntu Server. A logical volume is a container that stores data in a specific location on your hard drive. You can create as many logical volumes as you need to manage your disc space. When using a logical volume, you can:
- Minimize the amount of disk space used by your server
- Increase the speed at which your server runs
- Reduce the amount of time it takes to install and configure new software