LVM
LVM
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.
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.
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.
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
- Recover the LVM partition using vgcfgrestore and archive file and verify.
Verify if the deleted volume has been successfully restored or not using ‘lvscan’.
lvscan
lvchange -a y /dev/vg01/lv01
For
[RHEL 6 / 7]: Single command.
(lvreduce shipped with RHEL 5 is missing "-r" option, which takes care of resizing
underlying filesystem, hence, resize2fs is mandatory before shrinking logical
volume.)