Backing Up LVM Data for OES File System Recovery

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.

  1. save /etc/fstab

        [root ~]# cat /etc/fstab
        /dev/VolGroup01/LogVol00 /                      ext3    defaults        1 1
        LABEL=/boot             /boot                   ext3    defaults        1 2
        tmpfs                   /dev/shm                tmpfs   defaults        0 0
        devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
        sysfs                   /sys                    sysfs   defaults        0 0
        proc                    /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 ~]#
  2. save contents of /proc/partitions

        [root ~]# cat /proc/partitions
        major minor  #blocks  name
           8     0    8388608 sda
           8     1     104391 sda1
           8     2    8281507 sda2
           8    16    8388608 sdb
           8    17    8385898 sdb1
           8    32    8388608 sdc
         253     0    7208960 dm-0
         253     1    1048576 dm-1
         253     2    3891200 dm-2
         253     3    4493312 dm-3
        [root ~]#
        [root ~]# fdisk -l
        Disk /dev/sda: 8589 MB, 8589934592 bytes
        255 heads, 63 sectors/track, 1044 cylinders
        Units = cylinders of 16065 * 512 = 8225280 bytes
        Device Boot          Start        End     Blocks   Id  System
        /dev/sda1               1          13      104391   83  Linux
        /dev/sda2              14        1044     8281507+  8e  Linux LVM
        Disk /dev/sdb: 8589 MB, 8589934592 bytes
        255 heads, 63 sectors/track, 1044 cylinders
        Units = cylinders of 16065 * 512 = 8225280 bytes
         Device Boot         Start       End      Blocks   Id  System
        /dev/sdb1               1        1044     8385898+  83  Linux
        Disk /dev/sdc: 8589 MB, 8589934592 bytes
        255 heads, 63 sectors/track, 1044 cylinders
        Units = cylinders of 16065 * 512 = 8225280 bytes
         Device Boot         Start         End      Blocks   Id  System
        /dev/sdc1               1        1044     8385898+  83  Linux
        [root ~]#
  3. 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 ~]# lvm
        lvm>
        lvm> vgdisplay -v
        Finding all volume groups
        Finding volume group "VolGroup01"
          --- Volume group ---
          VG Name               VolGroup01
          System ID
          Format                lvm2
          Metadata Areas        1
          Metadata Sequence No  3
          VG Access             read/write
          VG Status             resizable
          MAX LV                0
          Cur LV                2
          Open LV               2
          Max PV                0
          Cur PV                1
          Act PV                1
          VG Size               7.88 GB
          PE Size               32.00 MB
          Total PE              252
          Alloc PE / Size       252 / 7.88 GB
          Free  PE / Size       0 / 0
          VG UUID               XTR8Sr-gcqw-WtKM-bi4a-fctP-0xH9-7vTsB0
          --- Logical volume ---
          LV Name                /dev/VolGroup01/LogVol00
          VG Name                VolGroup01
          LV UUID                q00hUf-Xqt5-ZcL4-rErN-xEmp-EgTB-vdvdwD
          LV Write Access        read/write
          LV Status              available
          # open                 1
          LV Size                6.88 GB
          Current LE             220
          Segments               1
          Allocation             inherit
          Read ahead sectors     auto
          - currently set to     256
          Block device           253:0
          --- Logical volume ---
          LV Name                /dev/VolGroup01/LogVol01
          VG Name                VolGroup01
          LV UUID                3A5SeG-PKUn-DaRm-0Bac-NPta-RdkB-N1Vx9P
          LV Write Access        read/write
          LV Status              available
          # open                 1
          LV Size                1.00 GB
          Current LE             32
          Segments               1
          Allocation             inherit
          Read ahead sectors     auto
          - currently set to     256
          Block device           253:1
          --- Physical volumes ---
          PV Name               /dev/sda2
          PV UUID               W0Y0cc-g4z1-ScQd-584L-40gR-I67d-YMuQih
          PV Status             allocatable
          Total PE / Free PE    252 / 0
          For example, to find volume group "xyzzy":
          --- Volume group ---
          VG Name               xyzzy
          System ID
          Format                lvm2
          Metadata Areas        1
          Metadata Sequence No  5
          VG Access             read/write
          VG Status             resizable
          MAX LV                0
          Cur LV                2
          Open LV               2
          Max PV                0
          Cur PV                1
          Act PV                1
          VG Size               8.00 GB
          PE Size               4.00 MB
          Total PE              2047
          Alloc PE / Size       2047 / 8.00 GB
          Free  PE / Size       0 / 0
          VG UUID               mRiLOx-Ehbl-upEX-bxzf-EGDS-UTiL-vIb8qt
          --- Logical volume ---
          LV Name                /dev/xyzzy/space
          VG Name                xyzzy
          LV UUID                R2DKYD-ljJP-nVfI-s1Gj-NgZi-glVb-XURMyS
          LV Write Access        read/write
          LV Status              available
          # open                 1
          LV Size                3.71 GB
          Current LE             950
          Segments               1
          Allocation             inherit
          Read ahead sectors     auto
          - currently set to     256
          Block device           253:2
          --- Logical volume ---
          LV Name                /dev/xyzzy/extra
          VG Name                xyzzy
          LV UUID                RtkNPS-FCcy-WOko-gSlc-J48d-Dq0J-YCnM5x
          LV Write Access        read/write
          LV Status              available
          # open                 1
          LV Size                4.29 GB
          Current LE             1097
          Segments               1
          Allocation             inherit
          Read ahead sectors     auto
          - currently set to     256
          Block device           253:3
          --- Physical volumes ---
          PV Name               /dev/sdc
          PV UUID               BftPia-mJZY-8eHA-BMNf-Jv38-Mbnl-bN5ej6
          PV Status             allocatable
          Total PE / Free PE    2047 / 0
  4. Exit from lvm

    vm> quit

        Exiting....
        [root ~]#
  5. 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
  6. Perform a full system (Default) backup

        vgcfgbackup –f <%s.VG_backup>
  7. 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

Loading...