Monday, March 16, 2015

Solaris/VxVM: Rebuilding a disk group from CBR backups.


Issue:
Rebuilding a disk group from CBR backups.


Solution:


Customer has accidentally destroyed a disk group, or there was some private region corruption. This would require a disk group rebuild.

You will need to have several things on hand to successfully complete a rebuild.

A current CBR backup (/etc/vx/cbr/bk  the file ending in .cfgrec)
You must know the exact disk media names for each disk in the disk group.
The disk group must have the exact same name.
If re-initializing disks due to vtoc/private region corruption, you must know the exact length, and offset of the private region
(to avoid making the private region too big, and overwriting the beginning of the file system.

For a disk group that has been destroyed/corrupted, the first step is to check the dir /etc/vx/cbr/bk for a recent configuration backup. We are working with a disk group that is called "tdg".


-bash-3.00# ls -al

total 8
drwxr-xr-x   4 root     root         512 May  8 09:18 .
drwxr-xr-x   3 root     root         512 May  8 09:20 ..
drwxr-xr-x   2 root     root         512 May  5 11:03 rootdg.1241470818.10.sprsx4100a0-18
drwxr-xr-x   2 root     root         512 May  8 09:20 tdg.1241799525.16.sprsx4100a0-18
We have a recent config backup, so we'll use that.

-bash-3.00# cd /etc/vx/cbr/bk/tdg.1241799525.16.sprsx4100a0-18

-bash-3.00# ls -al

total 48220
drwxr-xr-x   2 root     root         512 May  8 09:20 .
drwxr-xr-x   4 root     root         512 May  8 09:18 ..
-rw-r--r--   1 root     root     24649728 May  8 09:20 1241799525.16.sprsx4100a0-18.binconfig
-rw-r--r--   1 root     root        6502 May  8 09:19 1241799525.16.sprsx4100a0-18.cfgrec
-rw-r--r--   1 root     root        1652 May  8 09:20 1241799525.16.sprsx4100a0-18.dginfo
-rw-r--r--   1 root     root        2705 May  8 09:19 1241799525.16.sprsx4100a0-18.diskinfo

Next, Let's check to see if the configuration looks right in a vxprint. We are going to use the most recent file with the .cfgrec extension.


-bash-3.00# cat 1241799525.16.sprsx4100a0-18.cfgrec | vxprint -D -

Disk group: tdg

TY NAME         ASSOC        KSTATE   LENGTH   PLOFFS   STATE    TUTIL0  PUTIL0
dg tdg          tdg          -        -        -        -        -       -

dm Disk_0       emc_clariion0_50 -    7089920  -        -        -       -
dm Disk_1       emc_clariion0_51 -    7089920  -        -        -       -

v  tvol         fsgen        ENABLED  14178304 -        ACTIVE   -       -
pl tvol-01      tvol         ENABLED  14178304 -        ACTIVE   -       -
sd Disk_0-01    tvol-01      ENABLED  7089920  0        -        -       -
sd Disk_1-01    tvol-01      ENABLED  7088384  7089920  -        -       -

If this looks like the correct layout, we then need to dump this out into a format that vxmake can use to recreate the disk group objects.


# cat 1241799525.16.sprsx4100a0-18.cfgrec | vxprint -D - -mvprsh > /tmp/tdg.out
If you have any disks that need to be re-initialized due to private region corruption, etc., do it now. Make sure that you know the private region offset, and length for that particular disk.
We can get this information from the file with the extension ".diskinfo" in the "/etc/vx/cbr/bk/<config backup>" directory.


-bash-3.00# less 1241799525.16.sprsx4100a0-18.diskinfo
DISK_ATTRIBUTE
Number_of_disk_backup=       2
UUID=DGC%5FRAID%205%5FAPM00064800091%5F60060160C68218008412F61304EBDC11
Device:    emc_clariion0_50
devicetag: emc_clariion0_50
type:      auto
hostid:    sprsx4100a0-18
disk:      name=Disk_0 id=1241470402.9.sprsx4100a0-18
group:     name=tdg id=1241799525.16.sprsx4100a0-18
info:      format=cdsdisk,privoffset=256,pubslice=2,privslice=2
flags:     online ready private autoconfig autoimport imported
pubpaths:  block=/dev/vx/dmp/emc_clariion0_50s2 char=/dev/vx/rdmp/emc_clariion0_50s2
guid:      {9aeb85c0-1dd1-11b2-a9e2-00144fe54846}
udid:      DGC%5FRAID%205%5FAPM00064800091%5F60060160C68218008412F61304EBDC11
site:      -
version:   3.1
iosize:    min=512 (bytes) max=2048 (blocks)
public:    slice=2 offset=65792 len=7089920 disk_offset=0
private:   slice=2 offset=256 len=65536 disk_offset=0
update:    time=1241799527 seqno=0.25
ssb:       actual_seqno=0.0
headers:   0 240
configs:   count=1 len=48144
logs:      count=1 len=7296
Defined regions:
config   priv 000048-000239[000192]: copy=01 offset=000000 enabled
config   priv 000256-048207[047952]: copy=01 offset=000192 enabled
log      priv 048208-055503[007296]: copy=01 offset=000000 enabled
lockrgn  priv 055504-055647[000144]: part=00 offset=000000
Multipathing information:
numpaths:   1
c0t60060160C68218008412F61304EBDC11d0s2 state=enabled   type=primary

UUID=DGC%5FRAID%205%5FAPM00064800091%5F60060160C68218006C1EF93504EBDC11
Device:    emc_clariion0_51
devicetag: emc_clariion0_51
type:      auto
hostid:    sprsx4100a0-18
disk:      name=Disk_1 id=1241470406.11.sprsx4100a0-18
group:     name=tdg id=1241799525.16.sprsx4100a0-18
info:      format=cdsdisk,privoffset=256,pubslice=2,privslice=2
flags:     online ready private autoconfig autoimport imported
pubpaths:  block=/dev/vx/dmp/emc_clariion0_51s2 char=/dev/vx/rdmp/emc_clariion0_51s2
guid:      {9d34466e-1dd1-11b2-a9e2-00144fe54846}
udid:      DGC%5FRAID%205%5FAPM00064800091%5F60060160C68218006C1EF93504EBDC11
site:      -
version:   3.1
iosize:    min=512 (bytes) max=2048 (blocks)
public:    slice=2 offset=65792 len=7089920 disk_offset=0
private:   slice=2 offset=256 len=65536 disk_offset=0
update:    time=1241799527 seqno=0.25
ssb:       actual_seqno=0.0
headers:   0 240
configs:   count=1 len=48144
logs:      count=1 len=7296
Defined regions:
config   priv 000048-000239[000192]: copy=01 offset=000000 enabled
config   priv 000256-048207[047952]: copy=01 offset=000192 enabled
log      priv 048208-055503[007296]: copy=01 offset=000000 enabled
lockrgn  priv 055504-055647[000144]: part=00 offset=000000
Multipathing information:
numpaths:   1
c0t60060160C68218006C1EF93504EBDC11d0s2 state=enabled   type=primary


From this output, we can see that both disks are CDS format. Both disks, emc_clariion0_50 and emc_clariion0_51 have the private region offset of 256 and a length of 65536.
emc_clariion0_50 was named Disk_0, and emc_clariion0_50 was named Disk_1.

Now we will initialize them with these values.


-bash-3.00# vxdisksetup -i emc_clariion0_50 privlen=65536 privoffset=256
-bash-3.00# vxdisksetup -i emc_clariion0_51 privlen=65536 privoffset=256

Now re-create the disk group with the same disks, with exactly the same disk media names as before.


# vxdg init tdg Disk_0=emc_clariion0_50 Disk_1=emc_clariion0_51
Now if all the disks have the right disk media names, and are initialized with the correct private region sizes, we can replay the /tmp/tdg.out through vxmake.
This will recreate all of the volume manager objects that were in the disk group, at precisely the same place they were before.


-bash-3.00# vxmake -g tdg -d /tmp/tdg.out
Now check vxprint layout, and start the volumes.


-bash-3.00# vxprint -htqg tdg
dg tdg          default      default  24000    1241801076.30.sprsx4100a0-18

dm Disk_0       emc_clariion0_50 auto 65536    7101888  -
dm Disk_1       emc_clariion0_51 auto 65536    7101888  -

v  tvol         -            DISABLED EMPTY    14178304 SELECT    -        fsgen
pl tvol-01      tvol         DISABLED EMPTY    14178304 CONCAT    -        RW
sd Disk_0-01    tvol-01      Disk_0   0        7089920  0         emc_clariion0_50 ENA
sd Disk_1-01    tvol-01      Disk_1   0        7088384  7089920   emc_clariion0_51 ENA

Startup the volumes


-bash-3.00# vxvol -g tdg start tvol
Assuming everything went well, you should now be able to mount file systems, and check for consistency.

No comments:

Post a Comment