Add New Partitions and Logical Volumes

Red Hat Enterprise LinuxIntermediate
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

  • Use lsblk to identify the unused 40 GiB data disk. Do not modify the disk that already contains / and /boot/efi.
  • The new partition should be created on the unused data disk (for example, /dev/vdb or /dev/nvme0n1, depending on the VM).
  • 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. Your extra disk name may be different, but it must be the disk that is not already used by the operating system:

$ lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
nvme0n1                   259:0    0   40G  0 disk
└─nvme0n1p1               259:4    0    2G  0 part
  └─vg_project-lv_project 253:0    0    1G  0 lvm  /home/labex/project
nvme1n1                   259:1    0   40G  0 disk
├─nvme1n1p1               259:2    0    1M  0 part
├─nvme1n1p2               259:3    0  200M  0 part /boot/efi
└─nvme1n1p3               259:5    0 39.8G  0 part /
$ 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/nvme1n1p3                     40G  3.5G   37G   9% /
/dev/nvme1n1p2                    200M  7.1M  193M   4% /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