Add New Partitions and Logical Volumes

Red Hat Enterprise LinuxBeginner
Practice Now

Introduction

In this challenge, you will learn how to configure local storage on a Linux system by adding new partitions and logical volumes, as well as creating a swap space, without causing any data loss. This skill is essential for system administrators to efficiently manage and expand the storage capacity of their Linux servers.

Add New Partitions and Logical Volumes

In this challenge, you'll work with Linux storage management by creating partitions and logical volumes. You'll learn essential skills for expanding storage capacity on RHEL systems, including partitioning disks, setting up LVM (Logical Volume Manager), and mounting file systems. These are fundamental system administration tasks that allow you to efficiently manage storage resources without data loss.

Tasks

  • Create a new partition on the system's storage device.
  • Create a new logical volume group using the new partition.
  • Create a new logical volume within the new volume group.
  • Format the new logical volume with an appropriate file system.
  • Mount the new logical volume to a suitable directory.

Requirements

  • The new partition should be created on the /dev/vdb device.
  • The new partition should have a size of 2 GiB.
  • The new volume group should be named vg_project.
  • The new logical volume should be named lv_project and have a size of 1 GiB.
  • The new logical volume should be formatted with the ext4 file system.
  • The new logical volume should be mounted to the /home/labex/project directory.

Example

After completing this step, the output of lsblk and df -h commands should look similar to the following:

$ lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
vda                       253:0    0   40G  0 disk
├─vda1                    253:1    0    1M  0 part
├─vda2                    253:2    0  100M  0 part /boot/efi
└─vda3                    253:3    0 39.9G  0 part /
vdb                       253:16   0   40G  0 disk
└─vdb1                    253:17   0  1.9G  0 part
  └─vg_project-lv_project 252:0    0    1G  0 lvm  /home/labex/project
$ df -h
Filesystem                         Size  Used Avail Use% Mounted on
devtmpfs                           4.0M     0  4.0M   0% /dev
tmpfs                              1.8G     0  1.8G   0% /dev/shm
tmpfs                              712M  620K  712M   1% /run
efivarfs                           256K  8.5K  243K   4% /sys/firmware/efi/efivars
/dev/vda3                           40G  3.5G   37G   9% /
/dev/vda2                          100M  7.1M   93M   8% /boot/efi
tmpfs                              356M     0  356M   0% /run/user/1000
/dev/mapper/vg_project-lv_project  974M   24K  907M   1% /home/labex/project

Summary

In this challenge, you learned how to configure local storage on a Linux system by adding new partitions and logical volumes, as well as creating a swap space, without causing any data loss. You practiced creating a new partition, a new volume group, a new logical volume, formatting the logical volume, and mounting it to a suitable directory. This skill is essential for system administrators to efficiently manage and expand the storage capacity of their Linux servers.

✨ Check Solution and Practice