To recover OES file system with Logical Volume Manager (LVM), make sure to backup the required LVM data and obtain the configuration information of the original system.
About This Task
The section below illustrates the original configuration information needed for a recovery on a Red Hat 5.4 system. For simplicity, the new system hardware in this example is the same as the old system. The following steps should be performed only from the console.
Procedure
The following commands illustrate the types of data that need to be backed up to ensure a successful LVM restore.
-
save /etc/fstab
[root ~]# cat /etc/fstab/dev/VolGroup01/LogVol00 / ext3 defaults 1 1LABEL=/boot /boot ext3 defaults 1 2tmpfs /dev/shm tmpfs defaults 0 0devpts /dev/pts devpts gid=5,mode=620 0 0sysfs /sys sysfs defaults 0 0proc /proc proc defaults 0 0/dev/VolGroup01/LogVol01 swap swap defaults 0 0/dev/mapper/xyzzy-space /space ext3 acl,user_xattr,defaults 0 0/dev/mapper/xyzzy-extra /extra ext3 acl,user_xattr,defaults 0 0/dev/sdb1 /ext3 ext3 acl,user_xattr,defaults 0 0[root ~]# -
save contents of /proc/partitions
[root ~]# cat /proc/partitionsmajor minor #blocks name8 0 8388608 sda8 1 104391 sda18 2 8281507 sda28 16 8388608 sdb8 17 8385898 sdb18 32 8388608 sdc253 0 7208960 dm-0253 1 1048576 dm-1253 2 3891200 dm-2253 3 4493312 dm-3[root ~]#[root ~]# fdisk -lDisk /dev/sda: 8589 MB, 8589934592 bytes255 heads, 63 sectors/track, 1044 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/sda1 1 13 104391 83 Linux/dev/sda2 14 1044 8281507+ 8e Linux LVMDisk /dev/sdb: 8589 MB, 8589934592 bytes255 heads, 63 sectors/track, 1044 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/sdb1 1 1044 8385898+ 83 LinuxDisk /dev/sdc: 8589 MB, 8589934592 bytes255 heads, 63 sectors/track, 1044 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/sdc1 1 1044 8385898+ 83 Linux[root ~]# -
The interactive lvm command provides information of the configuration and status of the logical volumes. Individual commands, such as pvcreate to get the UUID’s of LVM disks, vgdisplay and lvdisplay can also be used.
[root ~]# lvmlvm>lvm> vgdisplay -vFinding all volume groupsFinding volume group "VolGroup01"--- Volume group ---VG Name VolGroup01System IDFormat lvm2Metadata Areas 1Metadata Sequence No 3VG Access read/writeVG Status resizableMAX LV 0Cur LV 2Open LV 2Max PV 0Cur PV 1Act PV 1VG Size 7.88 GBPE Size 32.00 MBTotal PE 252Alloc PE / Size 252 / 7.88 GBFree PE / Size 0 / 0VG UUID XTR8Sr-gcqw-WtKM-bi4a-fctP-0xH9-7vTsB0--- Logical volume ---LV Name /dev/VolGroup01/LogVol00VG Name VolGroup01LV UUID q00hUf-Xqt5-ZcL4-rErN-xEmp-EgTB-vdvdwDLV Write Access read/writeLV Status available# open 1LV Size 6.88 GBCurrent LE 220Segments 1Allocation inheritRead ahead sectors auto- currently set to 256Block device 253:0--- Logical volume ---LV Name /dev/VolGroup01/LogVol01VG Name VolGroup01LV UUID 3A5SeG-PKUn-DaRm-0Bac-NPta-RdkB-N1Vx9PLV Write Access read/writeLV Status available# open 1LV Size 1.00 GBCurrent LE 32Segments 1Allocation inheritRead ahead sectors auto- currently set to 256Block device 253:1--- Physical volumes ---PV Name /dev/sda2PV UUID W0Y0cc-g4z1-ScQd-584L-40gR-I67d-YMuQihPV Status allocatableTotal PE / Free PE 252 / 0For example, to find volume group "xyzzy":--- Volume group ---VG Name xyzzySystem IDFormat lvm2Metadata Areas 1Metadata Sequence No 5VG Access read/writeVG Status resizableMAX LV 0Cur LV 2Open LV 2Max PV 0Cur PV 1Act PV 1VG Size 8.00 GBPE Size 4.00 MBTotal PE 2047Alloc PE / Size 2047 / 8.00 GBFree PE / Size 0 / 0VG UUID mRiLOx-Ehbl-upEX-bxzf-EGDS-UTiL-vIb8qt--- Logical volume ---LV Name /dev/xyzzy/spaceVG Name xyzzyLV UUID R2DKYD-ljJP-nVfI-s1Gj-NgZi-glVb-XURMySLV Write Access read/writeLV Status available# open 1LV Size 3.71 GBCurrent LE 950Segments 1Allocation inheritRead ahead sectors auto- currently set to 256Block device 253:2--- Logical volume ---LV Name /dev/xyzzy/extraVG Name xyzzyLV UUID RtkNPS-FCcy-WOko-gSlc-J48d-Dq0J-YCnM5xLV Write Access read/writeLV Status available# open 1LV Size 4.29 GBCurrent LE 1097Segments 1Allocation inheritRead ahead sectors auto- currently set to 256Block device 253:3--- Physical volumes ---PV Name /dev/sdcPV UUID BftPia-mJZY-8eHA-BMNf-Jv38-Mbnl-bN5ej6PV Status allocatableTotal PE / Free PE 2047 / 0 -
Exit from lvm
vm> quit
Exiting....[root ~]# -
The original system has three disks partitioned as follows:
/dev/sda2 – Volume Group “VolGroup01-LogVol00” (root)/dev/sda2 – Volume Group “VolGroup01-LogVol01” (swap)/dev/sda1 - /boot/dev/sdb1 – standard ext3 file system mounted on /ext3/dev/sdc1 – Volume group “xyzzy”. Just a standard volume group with two logical volumes mounted to /extra and /space -
Perform a full system (Default) backup
vgcfgbackup –f <%s.VG_backup> -
Save the current Volume Group information. Copy the output files on another box. The e %s will be replaced with the VG name being backed up. One VG will be saved per file. The parameters of the command may vary depending upon the distribution you are using.
Result
In our example two files are created: VolGroup00.VG_backupxyzzy.VG_backup