Introduction

Logical Volume Management (LVM) is a method of allocating space on mass-storage devices that creates logical volumes. It provides a higher-level view of the disk storage on a computer system. In this guide, we'll walk through the steps to use LVM to manage storage devices on Ubuntu 18.04.

Prerequisites

Before proceeding, ensure you have:

  1. An Ubuntu 18.04 system

Steps to Use LVM to Manage Storage Devices

    1. Install LVM: If LVM is not already installed, install it using the following command:
sudo apt update
sudo apt install lvm2
    1. Create Physical Volumes (PVs): Identify the disk partitions you want to use as physical volumes and create them using the following command:
sudo pvcreate /dev/sdX
    1. Create Volume Groups (VGs): Create a volume group using the physical volumes with the following command:
sudo vgcreate my_vg /dev/sdX
    1. Create Logical Volumes (LVs): Create logical volumes within the volume group using the following command:
sudo lvcreate -n my_lv -L 10G my_vg
    1. Format and Mount the Logical Volume: Format the logical volume and mount it to a directory using the following commands:
sudo mkfs.ext4 /dev/my_vg/my_lv
sudo mkdir /mnt/my_lv
sudo mount /dev/my_vg/my_lv /mnt/my_lv

Conclusion

Congratulations! You have successfully used LVM to manage storage devices on your Ubuntu 18.04 system. You can now create logical volumes, resize them, and perform various other operations to manage your storage efficiently.

Was this answer helpful? 0 Users Found This Useful (0 Votes)