Monday, 27 July 2015

Creating and restoring a savevg backup without preserving mirrors

Question

How to create and/or restore an existing savevg backup without preserving mirrors.

Answer

This document describes how to restore a savevg image without preserving mirrors.
WARNING: This procedure is valid only with a savevg image and will not work with a Sysback 6000 system backup.

  • Creating a savevg without mirroring
  • Breaking mirrors on an existing savevg 
If the ability to rerun the savevg is available, the following procedure will allow you to create a savevg without preserving mirroring.

  1. To create a new /tmp/vgdata/<vgname>/<vgname>.data file, execute the following command.
  2.             mkvgdata <vgname>
    
    <vgname> is the name of the volume group to be backed up.
  3. Change directories to /tmp/vgdata/<vgname> and, using your favorite editor, edit the <vgname>.data file.
    For example:
                cd /tmp/vgdata/<vgname>
                vi <vgname>.data
    
  4. The following examples show an lv_data stanza of a <vgname>.data file. The first example is with mirroring, while the second example shows the edited version without mirroring. The lines that need changes are marked by -->. In the second example, the changes are made to those lines.
  5. To view and edit the file, using your favorite editor, open <vgname>.data:
       Example 1
                            lv_data:
                                    VOLUME_GROUP= <vgname>
                                    LV_SOURCE_DISK_LIST=  hdisk1
                                    LV_IDENTIFIER= 00000001113f3c62.5
                                    LOGICAL_VOLUME= lv00
                                    VG_STAT= active/complete
                                    TYPE= jfs
                                    MAX_LPS= 512
                           -->      COPIES = 2
                                    LPs = 70
                                    STALE_PPs= 0
                                    INTER_POLICY= minimum
                                    INTRA_POLICY= center
                                    MOUNT_POINT= /apps
                                    MIRROR_WRITE_CONSISTENCY= on
                                    LV_SEPARATE_PV= yes
                                    PERMISSION= read/write
                                    LV_STATE= opened/syncd
                                    WRITE_VERIFY= off
                                    PP_SIZE= 4
                                    SCHED_POLICY= parallel
                           -->      PP = 140
                                    BB_POLICY= relocatable
                                    RELOCATABLE= yes
                                    UPPER_BOUND= 32
                                    LABEL= /apps
                                    MAPFILE=
                                    LV_MIN_LPS= 68
       Example 2
                            lv_data:
                                    VOLUME_GROUP= <vgname>
                                    LV_SOURCE_DISK_LIST=  hdisk1
                                    LV_IDENTIFIER= 00000001113f3c62.5
                                    LOGICAL_VOLUME= lv00
                                    VG_STAT= active/complete
                                    TYPE= jfs
                                    MAX_LPS= 512
                           -->      COPIES = 1
                                    LPs = 70
                                    STALE_PPs= 0
                                    INTER_POLICY= minimum
                                    INTRA_POLICY= center
                                    MOUNT_POINT= /apps
                                    MIRROR_WRITE_CONSISTENCY= on
                                    LV_SEPARATE_PV= yes
                                    PERMISSION= read/write
                                    LV_STATE= opened/syncd
                                    WRITE_VERIFY= off
                                    PP_SIZE= 4
                                    SCHED_POLICY= parallel
                            -->     PP = 70
                                    BB_POLICY= relocatable
                                    RELOCATABLE= yes
                                    UPPER_BOUND= 32
                                    LABEL= /apps
                                    MAPFILE=
                                    LV_MIN_LPS= 68
    
    NOTE: In Example 2, the COPIES value has been changed to 1, and the PP value is set equal to the LPs value. Make these changes to each of the lv_datastanzas in the <vgname>.data file. Once you make the changes, save the file and exit.

  6. Run another savevg from the command line that will utilize your edited <vgname>.data file.
  7. # savevg -f /dev/rmtX <vgname>  
    
    X is the number of your tape device. You may also use a filename.

    WARNING: Do not run the savevg in SMIT because this will update the <vgname>.data file and overwrite any changes made.

    WARNING: Do not run the savevg with the -i flag because this will update the <vgname>.data file as well.
If another savevg cannot be run, the following procedure can be used to restore a savevg without mirroring.
All references to the tape device in the next section are as rmt0. You may also write the savevg backup to file.

  1. On the target system, place the savevg tape in the tape drive.
  2. Remove the /tmp/vgdata directory:
  3.                 rm -r /tmp/vgdata 
    
  4. Restore the /tmp/vgdata directory from the savevg tape:
  5.                cd /
                   restore -xqvdf /dev/rmt0 ./tmp/vgdata                
    
  6. Edit the /tmp/vgdata/<vgname>/<vgname>.data file, and make changes to each of the lv_data stanzas as indicated in the examples that follow. The lines that need changes are marked by a -->. In Example 4, the changes are made to those lines.

    To view and edit the file, using your favorite editor, open /tmp/vgdata/<vgname>/<vgname>.data:
         Example 3
                            lv_data:
                                    VOLUME_GROUP= <vgname>
                                    LV_SOURCE_DISK_LIST=  hdisk1
                                    LV_IDENTIFIER= 00000001113f3c62.5
                                    LOGICAL_VOLUME= lv01
                                    VG_STAT= active/complete
                                    TYPE= jfs
                                    MAX_LPS= 512
                            -->     COPIES = 2
                                    LPs = 120
                                    STALE_PPs= 0
                                    INTER_POLICY= minimum
                                    INTRA_POLICY= center
                                    MOUNT_POINT= /apps2
                                    MIRROR_WRITE_CONSISTENCY= on
                                    LV_SEPARATE_PV= yes
                                    PERMISSION= read/write
                                    LV_STATE= opened/syncd
                                    WRITE_VERIFY= off
                                    PP_SIZE= 4
                                    SCHED_POLICY= parallel
                            -->     PP = 240
                                    BB_POLICY= relocatable
                                    RELOCATABLE= yes
                                    UPPER_BOUND= 32
                                    LABEL= /apps2
                                    MAPFILE=
                                    LV_MIN_LPS= 68
         Example 4
                            lv_data:
                                    VOLUME_GROUP= <vgname>
                                    LV_SOURCE_DISK_LIST=  hdisk0
                                    LV_IDENTIFIER= 00000001113f3c62.5
                                    LOGICAL_VOLUME= lv01
                                    VG_STAT= active/complete
                                    TYPE= jfs
                                    MAX_LPS= 512
                            -->     COPIES = 1
                                    LPs = 120
                                    STALE_PPs= 0
                                    INTER_POLICY= minimum
                                    INTRA_POLICY= center
                                    MOUNT_POINT= /apps2
                                    MIRROR_WRITE_CONSISTENCY= on
                                    LV_SEPARATE_PV= yes
                                    PERMISSION= read/write
                                    LV_STATE= opened/syncd
                                    WRITE_VERIFY= off
                                    PP_SIZE= 4
                                    SCHED_POLICY= parallel
                            -->     PP = 120
                                    BB_POLICY= relocatable
                                    RELOCATABLE= yes
                                    UPPER_BOUND= 32
                                    LABEL= /apps2
                                    MAPFILE=
                                    LV_MIN_LPS= 120
    
    NOTE: In Example 4 the COPIES value has been changed to 1, and the PP value is set equal to the LPs value. Make these changes to each of the lv_datastanzas in the <vgname>.data file. Once you make the changes, save the file and exit.

  7. After making the changes to the <vgname>.data file, create a backbyname of /tmp/vgdata to run restvg against.
  8. #  cd /
    # find ./tmp/vgdata -print |backup -iqvf /tmp/vg.back
    
    This should back up the following files:
     ./tmp/vgdata
      ./tmp/vgdata/vgdata.files
      ./tmp/vgdata/<vgname> 
      ./tmp/vgdata/<vgname>/filesystems
      ./tmp/vgdata/<vgname>/<vgname>.data 
    
    <vgname> is the name of your volume group.

  9. Verify that the files were backed up, and that the file can be read:
  10.                 restore -Tqvf /tmp/vg.back
    
  11. Run the restvg command to recreate the volume group on the hdisks you want:
  12.   restvg -f /tmp/vg.back hdisk# hdisk# 
  13. This should complete fairly quickly (depending on how many logical volumes and file systems are being created) and return to the command line. Verify that the volume group and file systems were re-created:
  14.   lsvg -l <vgname>
    
    And verify the file systems mounted:
      mount 
    
  15. If all looks good, restore the files from the tape:
  16.   cd /
      restore -xqvdf /dev/rmt0
    

No comments:

Post a Comment