Total Pageviews

Friday, 18 July 2014

VXCONFIGBACKUP & VXCONFIGRESTORE !!!

Always it is better to take vxconfigbackup for critical systems at regular time intervals.
When config data (like private region,disk headers) of a DG gets corrupted, we can restore it from vxconfigbackup file using vxconfigrestore.

Let me start with vxconfigbackup :

vxconfigbackup takes backup of entire configuration information for one or more disk groups.

Full Path : /etc/vx/bin/vxconfigbackup
Default location of backup : /etc/vx/cbr/bk/

EXAMPLE : 
vxconfigbackup  --- Takes configbackup of all DGs and saves in default loaction.
vxconfigbackup dgname ---  Takes configbackup of a particular DG and saves in default loaction.
vxconfigbackup -l directory --- Takes configbackup of all DGs and saves in given location.
vxconfigbackup -l directory dgname/dgid --- Takes configbackup of a particular DG and saves in given location.

vxconfigbackup will takes backup of configuration files only, nowhere related with backup of data.

root@mydev #
root@mydev # df -kh
Filesystem             size   used  avail capacity  Mounted on
/dev/md/dsk/MYDEV         34G    17G    17G    51%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   118G   1.9M   118G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap2.so.1
                        34G    17G    17G    51%    /platform/sun4u-us3/lib/libc_psr.so.1
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap2.so.1
                        34G    17G    17G    51%    /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   118G   144K   118G     1%    /tmp
swap                   118G    48K   118G     1%    /var/run
swap                   118G     0K   118G     0%    /dev/vx/dmp
swap                   118G     0K   118G     0%    /dev/vx/rdmp
/dev/vx/dsk/MYDEVDATA/oracle
                       1.1T   291M   1.1T     1%    /oracle
/dev/vx/dsk/MYDEVARCH/oraarch
                        68G    82M    64G     1%    /oracle/MYDEV/oraarch
/dev/vx/dsk/MYDEVCI/usrsap
                        30G    73M    28G     1%    /usr/sap
/dev/vx/dsk/MYDEVCI/sapmnt
                        25G    71M    23G     1%    /sapmnt
root@mydev #
root@mydev #
root@mydev # vxdg list
NAME         STATE           ID
MYDEVDATA      enabled,cds          1405420307.56.mydev
MYDEVARCH      enabled,cds          1405420362.58.mydev
MYDEVCI        enabled,cds          1405420374.60.mydev
root@mydev #
root@mydev #
root@mydev # vxconfigbackup -l /tmp/cidg MYDEVCI
Start backing up diskgroup MYDEVCI to /tmp/cidg/MYDEVCI.1405420374.60.mydev ...

VxVM  NOTICE V-5-2-3100 Backup complete for diskgroup: MYDEVCI
root@mydev #

So as I told, If we want for all dg's   : vxconfigbackup -l /tmp/cidg
and if we want in default location     : vxconfigbackup -l
and if we want MYDEVCI in default location : vxconfigbackup -l MYDEVCI

root@mydev #
root@mydev # cd /tmp
root@mydev #
root@mydev # ls -lrth
total 80
drwxr-xr-x   2 noaccess noaccess     178 Jul 15 17:46 hsperfdata_noaccess
drwxr-xr-x   2 root     root         117 Jul 15 17:46 hsperfdata_root
drwx------   2 root     root         117 Jul 15 17:46 vx.025246.163531.034000.3760
drwxr-xr-x   3 root     root         199 Jul 15 18:19 cidg
drwx------   2 root     root         117 Jul 15 18:19 vx.043741.033410.164400.7489
root@mydev #
root@mydev #
root@mydev # cd cidg      ---- Directory which I specified to where the backup is to be saved.
root@mydev #
root@mydev # ls -lrth
total 16
drwxr-xr-x   2 root     root         454 Jul 15 18:19 MYDEVCI.1405420374.60.mydev
root@mydev #
root@mydev # cd MYDEVCI.1405420374.60.mydev --- Directory which contains entire config backup of my given DG.
root@mydev #
root@mydev # ls -lrth
total 48192
-rw-r--r--   1 root     root        1.3K Jul 15 18:19 1405420374.60.mydev.diskinfo     |
-rw-r--r--   1 root     root        7.5K Jul 15 18:19 1405420374.60.mydev.cfgrec        | files related to
-rw-r--r--   1 root     root         24M Jul 15 18:19 1405420374.60.mydev.binconfig  |  config info.
-rw-r--r--   1 root     root        4.1K Jul 15 18:19 1405420374.60.mydev.dginfo        |
root@mydev #
root@mydev #

Thus backup of config info taken successfully....

If there is any situation like config files got corrupted and DG is not getting imported, then we can restore from vxconfigbackup.

vxconfigrestore comes with different options which helps us to choose what corrupted things need to get restored and what else need to be omitted.

root@mydev # vxconfigrestore
VxVM vxconfigrestore ERROR V-5-2-3450 Usage: vxconfigrestore [ -c | -d | -n | -p ] [ -l directory ] {dgname | dgid}
root@mydev #

-c  (Commit) To commit changes to the disks permanently.

-d  (Decommit) At precommit stage we can abandon the restore operation .

-n  (Precommit with no installation of VxVM disk header) Loads the disk group configuration only. It specifies that no corrupted private region headers should not be reinstalled.

-l  (directory) To Specify a directory other than the default (/etc/vx/cbr/bk) where the backup configuration files need to be saved.

-p  (Precommit: load) Loads DG configuration along with corrupted disk headers (reinstalled).

The actual DG configuration is not permanently restored until we choose to commit the changes.

root@mydev # vxdg import MYDEVCI
VxVM vxdg ERROR V-5-1-10978 Disk group MYDEVCI: import failed: 
Disk group has no valid configuration copies
root@mydev #

Let's try importing forcefully...

root@mydev # vxdg -Cf import MYDEVCI
VxVM vxdg ERROR V-5-1-10978 Disk group MYDEVCI: import failed: 
Disk group has no valid configuration copies
root@mydev #

Now let us restore the config from the backup which we took and saved in /tmp/cidg.....

root@mydev #
root@mydev # vxconfigrestore -p -l /tmp/cidg MYDEVCI
Diskgroup MYDEVCI configuration restoration started ......

Installing volume manager disk header for emcpower46 ...

MYDEVCI diskgroup configuration is restored (in precommit state).
Diskgroup can be accessed in read only and can be examined using
vxprint in this state.

Run:
  vxconfigrestore -c MYDEVCI ==> to commit the restoration.
  vxconfigrestore -d MYDEVCI ==> to abort the restoration.

root@mydev #
root@mydev #
root@mydev # vxconfigrestore -c MYDEVCI             ---- To commit the restoration.
Committing configuration restoration for diskgroup MYDEVCI ....

MYDEVCI diskgroup configuration restoration is committed.
root@mydev #
root@mydev #
root@mydev #
root@mydev # vxdg list
NAME         STATE           ID
MYDEVDATA      enabled,cds          1405420307.56.mydev
MYDEVARCH      enabled,cds          1405420362.58.mydev
MYDEVCI        enabled,cds          1405420374.60.mydev
root@mydev #
root@mydev #
root@mydev # vxdg deport MYDEVCI       ---- Now try to deport and re-import the DG once.
root@mydev #
root@mydev # vxdg list
NAME         STATE           ID
MYDEVDATA      enabled,cds          1405420307.56.mydev
MYDEVARCH      enabled,cds          1405420362.58.mydev
root@mydev #
root@mydev #
root@mydev # vxdg import MYDEVCI
root@mydev #
root@mydev # vxdg list
NAME         STATE           ID
MYDEVDATA      enabled,cds          1405420307.56.mydev
MYDEVARCH      enabled,cds          1405420362.58.mydev
MYDEVCI        enabled,cds          1405420374.60.mydev
root@mydev #

Hence the DG got imported successfully after restoring the config from backup file.

################################################################################

No comments:

Post a Comment