How To Install lvm2 on Ubuntu 20.04

In this tutorial we learn how to install lvm2 on Ubuntu 20.04. lvm2 is Linux Logical Volume Manager Linux Logical Volume Manager

Introduction

In this tutorial we learn how to install lvm2 on Ubuntu 20.04.

What is lvm2

lvm2 is:

This is LVM2, the rewrite of The Linux Logical Volume Manager. LVM supports enterprise level volume management of disk and disk subsystems by grouping arbitrary disks into volume groups. The total capacity of volume groups can be allocated to logical volumes, which are accessed as regular block devices. Task: server, cloud-image, ubuntu-live, kubuntu-live, xubuntu-live, lubuntu-live, ubuntustudio-dvd-live, ubuntukylin-live, ubuntu-mate-live, ubuntu-budgie-live

Package: lvm2 Architecture: amd64 Version: 2.03.07-1ubuntu1 Multi-Arch: foreign Priority: optional Section: admin Origin: Ubuntu Maintainer: Ubuntu Developers [email protected] Original-Maintainer: Debian LVM Team [email protected] Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 3860 Depends: libaio1 (>= 0.3.93), libblkid1 (>= 2.24.2), libc6 (>= 2.28), libdevmapper-event1.02.1 (>= 2:1.02.74), libreadline5 (>= 5.2), libselinux1 (>= 1.32), libsystemd0 (>= 222), libudev1 (>= 183), lsb-base, dmsetup (>= 1.02.145-2~), dmeventd Recommends: thin-provisioning-tools Conflicts: clvm Filename: pool/main/l/lvm2/lvm2_2.03.07-1ubuntu1_amd64.deb Size: 1052640 MD5sum: 6f74b4b0dd8c0c15eb4a01f88ebaf130 SHA1: f26d527524cd55d46e5551c063fec312679dde7c SHA256: cc05480fa8208cd124e46aec1558e0e10f7bd0c73b5a9e5f6c7c90dfb44e3aaf Homepage: http://sources.redhat.com/lvm2/ Description-en: Linux Logical Volume Manager This is LVM2, the rewrite of The Linux Logical Volume Manager. LVM supports enterprise level volume management of disk and disk subsystems by grouping arbitrary disks into volume groups. The total capacity of volume groups can be allocated to logical volumes, which are accessed as regular block devices. Task: server, cloud-image, ubuntu-live, kubuntu-live, xubuntu-live, lubuntu-live, ubuntustudio-dvd-live, ubuntukylin-live, ubuntu-mate-live, ubuntu-budgie-live

There are three methods to install lvm2 on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install lvm2 Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install lvm2 using apt-get by running the following command:

sudo apt-get -y install lvm2

Install lvm2 Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install lvm2 using apt by running the following command:

sudo apt -y install lvm2

Install lvm2 Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install lvm2 using aptitude by running the following command:

sudo aptitude -y install lvm2

How To Uninstall lvm2 on Ubuntu 20.04

To uninstall only the lvm2 package we can use the following command:

sudo apt-get remove lvm2

Uninstall lvm2 And Its Dependencies

To uninstall lvm2 and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove lvm2

Remove lvm2 Configurations and Data

To remove lvm2 configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge lvm2

Remove lvm2 configuration, data, and all of its dependencies

We can use the following command to remove lvm2 configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge lvm2

References

Summary

In this tutorial we learn how to install lvm2 package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.