Cloud Computing Training
Report Task: 02
Dated: 20th Feb 2025
By: Rabbiya Tabassum
Task:
1. Explore Linux Volume Management (lvm).
2. Create a linux server on VMware workstation or virtual box. Attach a secondary
volume
3. Create an lvm partition.
4. Resize existing partition (without data loss)
Logical Volume Management (LVM)
Logical Volume Management, or LVM, provides a method of allocating and managing
space on mass-storage devices that is more advanced and flexible than the traditional
method of partitioning storage volumes.
Key concepts
There are 3 concepts that LVM manages:
● Physical volumes: correspond to disks. They represent the lowest abstraction
level of LVM, and are used to create a volume group.
● Volume groups: are collections of physical volumes. They are pools of disk
space that logical volumes can be allocated from.
● Logical volumes: correspond to partitions – they usually hold a filesystem. Unlike
partitions though, they can span multiple disks (because of the way volume
groups are organised) and do not have to be physically contiguous.
LVM enables seamless storage management, allowing administrators to dynamically
resize, migrate, and allocate storage space as per their evolving needs.
Create a linux server on VMware workstation or virtual
box. Attach a secondary volume
Step:01
Step:02
Step: 03
Step: 04
Step:05
LVM Setup on /dev/sdb
1. Initialize Physical Volume
First, initialize /dev/sdb as a physical volume (PV) for use by LVM:
This command prepares the disk to be used as part of LVM.
Step: 06
Create Volume Group
Next, create a volume group (VG) that includes the new physical volume. You can name
the volume group anything you like; here we'll call it volumeGroup1.
creates a new volume group named volumeGroup1 that includes the physical volume
/dev/sdb.
Step:07
Create Logical Volume
Now, create a logical volume (LV) within this volume group. Let’s say we create a logical
volume named logicalVolume1 with a size of 20GB.
creates a new logical volume named logicalVolume1 within volumeGroup1 and
allocates 20GB of space to it.
Step:08
Format the Logical Volume
After creating the logical volume, format it with a file system. We'll use ext4. The
command formats the logical volume logicalVolume1 with the ext4 filesystem.
Step:09
Mount the Logical Volume
Before you can use the new logical volume, you need to mount it. First, create a
directory to mount it to:
mount the logical volume to the newly created directory:
Step: 10
Verify the Mount
Check that the logical volume is mounted correctly by listing the mounted file systems:
Automate Mount on Boot
To ensure the logical volume mounts automatically on system boot, add it to the
/etc/fstab file:
Resizing the LVM Partition (Without Data Loss)
Step: 11
Check Available Space in the Volume Group
Run the following command to see how much free space is left in volumeGroup1:
Step: 12
Extend the Logical Volume
If free space available, extend the logical volume by 5GB (adjust size as per
requirement/need):
If we want to use all available free space in the volume group, use:
Step: 13
Resize the Filesystem (Without Unmounting)
Since we are using an ext4 filesystem, you can resize it without unmounting:
Step: 14
Verify the New Size