Working with Logical Volumes

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

Logical Volume Management (LVM) allows block devices such as partitions and raw disks to be grouped together to provide flexible storage on a Linux host. In this hands-on lab, we cover creating physical volumes, grouping them into a volume group, creating logical volumes from the volume group, and creating and mounting file systems on the logical volumes. We also resize logical volumes, create snapshots, and restore snapshots.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create Two Logical Volumes Based on the Information Provided in the Instructions

Once connected via ssh, elevate your privileges to root:

sudo -i
  1. Create physical volumes out of the following partitions:
    • xvdf1
    • xvdf2
    • xvdf3
    • xvdf4
  2. Create a volume group called user_vg out of the physical volumes.
  3. Create a logical volume named dev_lv that is 200 MB.
  4. Create a logical volume named test_lv that is 64 extents.
Create File Systems on the `dev_lv` and `test_lv` Logical Volumes
  1. Create an ext4 file system on dev_lv.
  2. Create an xfs file system on test_lv.
  3. Create two mount points: /mnt/dev and /mnt/test.
  4. Add entries for dev_lv and test_lv to /etc/fstab.
  5. Mount the dev_lv and test_lv file systems on /mnt/dev and /mnt/test respectively.
Resize the `graphics_lv` and `docs_lv` Logical Volumes
  1. Increase the graphics_lv logical volume by 50 extents.
  2. Shrink the docs_lv logical volume by 100 MB.
Perform a Snapshot of the `prod_lv` Logical Volume and Restore the `stage_snap` Snapshot to Its Origin Volume
  1. Create a snapshot of the prod_lv logical volume called prod_snap that has a size of 50 MB.
  2. Restore the stage_snap snapshot to its origin volume.
  3. Unmount /mnt/staging.
  4. Merge the stage_snap snapshot with its origin volume.

Additional Resources

You work as part of a team of Linux administrators in your company and you have been tasked with performing several tasks involving LVM. First, you will need to create physical volumes out of the following partitions: xvdf1, xvdf2, xvdf3, and xvdf4. These physical volumes should then be grouped into a volume group called user_vg. Then, two logical volumes will need to be created. The first should be called dev_lv and the size should be 200 MB. The second should be called test_lv and the size should be 64 extents.

The second task is to create an ext4 file system on dev_lv and an xfs file system on test_lv. These file systems should be mounted on /mnt/dev and /mnt/test respectively, and entries should be added to /etc/fstab so that they persist through a reboot.

The third task is to resize some existing logical volumes and their underlying file systems. The graphics_lv logical volume should be increased by 50 extents and the docs_lv logical volume should be reduced by 100 MB. Finally, you will need to create a 50 MB snapshot of the prod_lv logical volume and name it prod_snap and restore (merge) the stage_snap snapshot with its origin logical volume.

Note: Once connected via ssh, elevate your privileges to root:

sudo -i

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!