0% found this document useful (0 votes)
15 views

LVM

LVM (Logical Volume Management) is a tool for managing disk space that allows for flexible allocation, striping, mirroring, and resizing of logical volumes. It involves creating physical volumes (PVs), volume groups (VGs), and logical volumes (LVs) to manage storage efficiently. The document also outlines procedures for creating, resizing, and restoring LVM volumes, as well as commands for managing partitions and verifying configurations.

Uploaded by

bharadwajgopi.pv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

LVM

LVM (Logical Volume Management) is a tool for managing disk space that allows for flexible allocation, striping, mirroring, and resizing of logical volumes. It involves creating physical volumes (PVs), volume groups (VGs), and logical volumes (LVs) to manage storage efficiently. The document also outlines procedures for creating, resizing, and restoring LVM volumes, as well as commands for managing partitions and verifying configurations.

Uploaded by

bharadwajgopi.pv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1) What is LVM and what is its advantage?

LVM is a tool for logical volume management which includes allocating disks,
striping, mirroring and resizing logical volumes.
LVM allows for very flexible disk space management. It provides features like the
ability to add disk space to a logical volume and it is collection of multiple
physical hard drives and partitions into a single volume group which can then be
divided into logical volumes.

2) What is ihe hexa/ID number for LVM partition, swap , primary and extend?

Every partion type will have one ID..example for primary partition 83, extended 5,
swap 82 and LVM 8e.

3) Explain how to create a lvm mount?

Ask storage team for new LUN if no free disk is not availanle.
Rescan the HBAs
Once disk is visible in OS level,partion it and change id as LVM
create PV
Create VG
Create LV and cretae file system on it.
Create a directory and mount it and make entry in fstab to make it permananent at
boot level.

4) As per the customer request how to increase the LV size?

check if any free space is there in VG.


If space is there do lvextend and resize2 fs.
If free space is not there in VG , ask storage team for new LUN
rescan the HBAs
partion the new disk with lvm id.
Create pratition
Create PV
extend VG
Extend LV and do resize2fs.
And validate file system size with df -h.

5) what is lvscan?

lvrescan scans all known volume groups or all supported LVM block devices in the
system for defined Logical Volumes. The output consists of one line for each
Logical Volume indicating whether or not it is active, a snapshot or origin, the
size of the device and its allocation policy.

6) what is lvmdiskscan.

It will show the existing disk and whther if it is under lvm control or not.
after pvcreate is the command to bring the disk into lvm control.

6) How to restore the LV?

https://www.thegeekdiary.com/corruption-or-accidental-deletion-in-lvm-how-to-rebuil
d-lvm-from-archive-metadata-backups-in-rhel-centos/

# lvremove vg01/lv01

# cd /etc/lvm/archive/

(By default, the metadata backup is stored in the /etc/lvm/backup file and the
metadata archives are stored in the /etc/lvm/archive file)

- First find the backed up configurations of Volume Group (vg1 in this case)
# vgcfgrestore --list vg1

- Before running the actual restore you can do a dry run using the –test switch as
shown below.
# vgcfgrestore vg01 --test -f /etc/lvm/archive/vg01_00002-1315455408.vg
TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
Restored volume group vg01

If the above dry run is successful, do the actual restore.

- Recover the LVM partition using vgcfgrestore and archive file and verify.

# vgcfgrestore vg01 -f /etc/lvm/archive/vg01_00002-1315455408.vg

Verify if the deleted volume has been successfully restored or not using ‘lvscan’.

lvscan

Activate the LV to access the data onto it.

lvchange -a y /dev/vg01/lv01

Mount the logical volume and verify if the data is intact.

7) How do you decrease the LV.

unmount the LV if no one is using.

Run fsck force fully.

Resize the LV filesystem to required size.


Ex:
# resize2fs /dev/mapper/vg_root-lv_data01 100G

shrink the file system.


# lvreduce -L 100G /dev/mapper/vg_root-lv_data01

For
[RHEL 6 / 7]: Single command.

# lvreduce -r -L 80G /dev/vg0/lv_data

(lvreduce shipped with RHEL 5 is missing "-r" option, which takes care of resizing
underlying filesystem, hence, resize2fs is mandatory before shrinking logical
volume.)

You might also like