Table of Contents
In this article, we will see how to install LVM utilities on Ubuntu 20.04 LTS (Focal Fossa). If you are using some Debian based system like Ubuntu 20.04 LTS Server then there are chances that LVM utilities might not be available in your System. Because of this whenever you try to use these utilities, you will always end up with "command not found" error. So to fix this you need to install lvm2 package in your System. We will see the steps to install this package in detail. More about LVM.
How to Install LVM Utilities on Ubuntu 20.04 LTS (Focal Fossa)
Also Read: How to Install Iptables services on RHEL/CentOS/Rocky Linux
Step 1: Prerequisites
a) You should have a running Ubuntu 20.04 LTS
Server.
b) You should have sudo
or root
access to run privileged command.
c) You should have apt
or apt-get
utility available in your System.
Step 2: Update Your Server
Before you install lvm2 package, first sync your package cache with the all enabled source repository using apt update command. If any package needs to be upgraded then upgrade it by using apt upgrade
command.
root@cyberithub:~# apt update
Hit:1 http://in.archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:4 https://dl.google.com/linux/chrome/deb stable InRelease [1,811 B]
Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,510 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [592 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [281 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [14.7 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu focal-updates/universe i386 Packages [664 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [894 kB]
Get:12 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [364 kB]
..............................................................................................
Step 3: Install LVM Utilities
Next step is to install LVM utilities using apt install lvm2
command as shown below. This will install lvm2 package along with all its required dependencies.
root@cyberithub:~# apt install lvm2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
dmeventd libaio1 libdevmapper-event1.02.1 liblvm2cmd2.03 libreadline5 thin-provisioning-tools
The following NEW packages will be installed:
dmeventd libaio1 libdevmapper-event1.02.1 liblvm2cmd2.03 libreadline5 lvm2 thin-provisioning-tools
0 upgraded, 7 newly installed, 0 to remove and 341 not upgraded.
Need to get 2,255 kB of archives.
After this operation, 8,919 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libdevmapper-event1.02.1 amd64 2:1.02.167-1ubuntu1 [11.9 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libaio1 amd64 0.3.112-5 [7,184 B]
Get:3 http://in.archive.ubuntu.com/ubuntu focal/main amd64 liblvm2cmd2.03 amd64 2.03.07-1ubuntu1 [673 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu focal/main amd64 dmeventd amd64 2:1.02.167-1ubuntu1 [35.1 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libreadline5 amd64 5.2+dfsg-3build3 [100 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu focal/main amd64 lvm2 amd64 2.03.07-1ubuntu1 [1,053 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal/main amd64 thin-provisioning-tools amd64 0.8.5-4build1 [375 kB]
.......................................................................
Step 4: Verify Package Installation
You can verify the installation path and list of utilities available through lvm2 package using dpkg -L lvm2 command as shown below.
root@cyberithub:~# dpkg -L lvm2
/.
/etc
/etc/init.d
/etc/init.d/lvm2
/etc/init.d/lvm2-lvmpolld
/etc/lvm
/etc/lvm/lvm.conf
/etc/lvm/lvmlocal.conf
/etc/lvm/profile
/etc/lvm/profile/cache-mq.profile
/etc/lvm/profile/cache-smq.profile
/etc/lvm/profile/command_profile_template.profile
/etc/lvm/profile/lvmdbusd.profile
/etc/lvm/profile/metadata_profile_template.profile
/etc/lvm/profile/thin-generic.profile
/etc/lvm/profile/thin-performance.profile
/etc/lvm/profile/vdo-small.profile
..............................................................
Step 5: Check Utilities Version
After successful installation, you can check some of the utilities version by using below command.
root@cyberithub:~# pvcreate --version root@cyberithub:~# vgcreate --version root@cyberithub:~# lvcreate --version
Step 6: Uninstall LVM Utilities
In case you are not planning to use LVM any further or does not required LVM utilities anymore then you can remove them by using apt remove lvm2
command as shown below.
root@cyberithub:~# apt remove lvm2 Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: dmeventd libaio1 libdevmapper-event1.02.1 liblvm2cmd2.03 libreadline5 thin-provisioning-tools Use 'apt autoremove' to remove them. The following packages will be REMOVED: lvm2 0 upgraded, 0 newly installed, 1 to remove and 341 not upgraded. After this operation, 3,953 kB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 183880 files and directories currently installed.) Removing lvm2 (2.03.07-1ubuntu1) ... Warning: Stopping lvm2-lvmpolld.service, but it can still be activated by: lvm2-lvmpolld.socket Processing triggers for man-db (2.9.1-1) ...