Difference between revisions of "LVM Management (overview)"

From vpsget wiki
Jump to: navigation, search
(Created page with "[DRAFT] In case of LVM related issues try next: Scan all disks for partiitions: pvscan lvm pvscan #the same Scan all disks for volume groups and build /etc/lvmtab and /et...")
 
Line 2: Line 2:
  
 
In case of LVM related issues try next:  
 
In case of LVM related issues try next:  
Scan all disks for partiitions:  
+
'''Scan all disks for partiitions:  
 
  pvscan
 
  pvscan
 
  lvm pvscan #the same
 
  lvm pvscan #the same
Line 26: Line 26:
 
http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm
 
http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm
  
 
+
'''Restore VG from backup/archive
```Restore VG from backup/archive
 
  
 
Restore lvm partition
 
Restore lvm partition
Line 39: Line 38:
 
Done.
 
Done.
  
lvrestore the whole physical volume pv90
+
'''lvrestore the whole physical volume pv90
 
https://www.jethrocarr.com/2013/11/23/restoring-lvm-volumes/
 
https://www.jethrocarr.com/2013/11/23/restoring-lvm-volumes/
  

Revision as of 15:33, 30 September 2015

[DRAFT]

In case of LVM related issues try next: Scan all disks for partiitions:

pvscan
lvm pvscan #the same

Scan all disks for volume groups and build /etc/lvmtab and /etc/lvmtab.d/* which are the database for all other lvm commands:

vgscan 
lvm vgscan #the same

Scan all disks for logical volumes

lvscan  
lvm lvscan #the same

Change attributes of a logical volume

lvm lvchange -ay VolGrp_name

Run fsck

fsck -f /dev/VolGrp_name/LogVol00

View :

pvdisplay
vgdisplay
lvdisplay


Usefull link: http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm

Restore VG from backup/archive

Restore lvm partition

  1. lvm IRC channel by kabi_ the solution for others who might find themselves in the same boat:

look in /etc/lvm/archive and find the file that has the information just prior to the destructive act in this text file is a UUID for the volume that has been corrupted boot into rescue disk (or single user mode if the corrupted disk is not your boot volume) and run the following

pvcreate --config 'global{locking_type=0}' --uuid <UUID> --restorefile /etc/lvm/backup/<file containing previous info> /dev/<device>
vgcfgrestore -f /etc/lvm/archive/<file containing previous info> <volume group name>

Done.

lvrestore the whole physical volume pv90 https://www.jethrocarr.com/2013/11/23/restoring-lvm-volumes/

  1. less /etc/lvm/archive/vg_storage_00677-187019982.vg

...

  physical_volumes {
     pv0 {
        id = "BgR0KJ-JClh-T2gS-k6yK-9RGn-B8Ls-LYPQP0"

...

  1. pvcreate --uuid "BgR0KJ-JClh-T2gS-k6yK-9RGn-B8Ls-LYPQP0" \
 --restorefile /etc/lvm/archive/vg_storage_00677-187019982.vg

Usefull links: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Logical_Volume_Manager_Administration/mdatarecover.html

http://coding.infoconex.com/post/2012/10/12/Running-FSCK-on-an-LVM-(Logical-Volume-Manager)-using-Linux-Rescue-Disk

http://serverfault.com/questions/433275/lvm-logical-volume-partition-corrupted-after-lvreduce