Introduction
In this challenge, you will learn how to extend an existing logical volume on a Linux system. This is a common task in system administration, as storage requirements often grow over time, and you need to be able to expand your file systems to accommodate the increased demand.
Extend an Existing Logical Volume
An existing server is running out of disk space on a logical volume. As the system administrator, you have been tasked with extending the logical volume to accommodate more data. An additional partition, /dev/vdb2, is available for you to add to the volume group and extend the logical volume.
Before you begin, it's good practice to inspect the current LVM setup. This will help you understand the starting point for the challenge. You can run the following commands to check the current status:
Check Physical Volumes, Volume Groups, and Logical Volumes:
sudo pvs && sudo vgs && sudo lvs
This will show you the existing Physical Volume (/dev/vdb1), Volume Group (vg_data), and Logical Volume (lv_data) with its initial 2GiB size.
Check the block devices:
lsblk
This command will list available block devices. You should see the /dev/vdb disk with its partitions, including the unused /dev/vdb2, which you will use to extend the volume.
Understanding this initial state is key to successfully completing the challenge.
Tasks
- Initialize the
/dev/vdb2partition as a new physical volume. - Add the new physical volume to the
vg_datavolume group. - Extend the
lv_datalogical volume to a total size of at least 4 GiB. - Resize the filesystem on the logical volume to use the newly available space.
Requirements
- The initial setup includes a 2GiB logical volume named
lv_datain thevg_datavolume group, which is created on the/dev/vdb1partition. - You must use the
/dev/vdb2partition to extend the volume group. - The extended logical volume must have a total size of at least 4 GiB.
Example
After completing the steps, the lvdisplay command for /dev/vg_data/lv_data should show a size of 4.00 GiB. You can verify this with the following command:
sudo lvdisplay /dev/vg_data/lv_data
Look for the LV Size line in the output:
--- Logical volume ---
...
LV Size 4.00 GiB
...
Summary
In this challenge, you learned how to extend an existing logical volume on a Linux system. You created a new physical volume, added it to an existing volume group, and then extended the logical volume to use the additional space. This is an important skill for system administrators, as it allows you to grow your file systems as your storage requirements change over time.



