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