Solaris SVM – How to Restore a Mirrored Root Configuration from Backup

SVM root Mirror Recovery from BackuoIn this scenario we are assuming that we  have full backup of the new disk.  In order to restore the machine exactly the way it was, it is necessary to have a record of the locations of the state databases, and also the configuration of the metadevices. These are not held in user-readable form on the root filesystem. That is the one reason we should follow a standard practices to create root mirrors so that will allow us to follow a common procedure to recover the mirrors from backup.
If you don’t have the standard configuration for root mirror, you should keep the outputs of following commands handy 

# metadb -i    

– Shows the condition and location of Disk Suite’s state database replicas. It is useful to have this information in case their recreation is necessary.

# metastat -p
– Shows the most current, known, configuration. The output needs to be redirected to a file for safekeeping. 
Note :    In some other cases we will have the necessary information in /etc/lvm/md.tab file for disaster recovery purposes.   
Note :   Patition tables on crashed disk and new disk used for backup restore should be same. 
Note:    Please make sure you have allocate a small partition for a state replica, just similar to your crashed disk.
Steps to Follow :

:::: Tasks associated with root file system restore

Step 1: Boot cdrom, and mount the root filesystem to /a.
ok> boot cdrom -s
# mount /dev/dsk/c#t#d#s# /a
Step 2: After Restoring the root filesystem from backup tape into /a, initialize the boot block using
# installboot /usr/platform/lib/fs/ufs/bootblk /dev/rdsk/c#t#d#s#
Step 3: Mount and restore any other critical filesystems such as /usr, /var, /opt, etc.

::::  Removing Meta device and State Database Configuration Data:

Step 1: Once the disk has been created, and restored the root file systems from backups, you must make some necessary changes to let Solaris know that the root disk is no longer mirrored, before attempting to boot the system after the restore.
Step 2: If system is using a grub enabled operating system ( Solaris 10 update 1 or higher for x86 or Solaris 10 update 6 or higher for sparc)
# bootadm update-archive -R /a

::::  Recreating Mirrored root configuration:

Step 1: Boot the system from the newly restored boot disk. When the system comes up, only root (and /usr, /var, and /opt, if they exist) will be mounted using the slices on the new root disk.
Step 2: Re-add the state databases with the ‘metadb’ command. Use the output of the ‘metadb’ command you saved to get the locations.
# metadb -a -f -c <> slice
Step 3: Recreate the “/etc/lvm/md.tab” file from the ‘metastat’ output you saved, except make sure that all mirrors to be one-way mirrors and all RAID5 devices contain the “-k” option. For the boot disk, ensure that the one-way mirrors refer to the side which has been restored. Make sure the order is correct so that mirrors aren’t created until the submirrors already exist.
See below the necessary changes that must be made to ensure one-way mirrors are used, for example:
# vi md.tab
 
** EXAMPLE FILE BEFORE:
————————————————-
d0 -m d10 d20 <– see the two-way mirror!
d10 1 1 c0t0d0s0
d20 1 1 c1t0d0s0
d1 -m d11 d21
d11 1 1 c0t0d0s1
d21 1 1 c1t0d0s1
d2 -m d12 d22
d12 1 1 c0t0d0s6
d22 1 1 c1t0d0s6
d3 -m d13 d23
d13 1 1 c0t0d0s7
d23 1 1 c1t0d0s7
d4 -m d14 d24
d14 1 1 c0t0d0s4
d24 1 1 c1t0d0s4
d5 -m d15 d25
d15 4 c0t1d0s2 c0t2d0s2 c1t1d0s2 c1t2d0s2
d25 4 c0t3d0s2 c1t3d0s2 c1t4d0s2 c1t5d0s2
d6 -r c1t6d0s2 c1t8d0s2 c1t9d0s2
————————————————-
** EXAMPLE FILE AFTER:
————————————————-
d10 1 1 c0t0d0s0
d20 1 1 c1t0d0s0
d0 -m d10 <– see the one-way mirror!
d11 1 1 c0t0d0s1
d21 1 1 c1t0d0s1
d1 -m d11
d12 1 1 c0t0d0s6
d22 1 1 c1t0d0s6
d2 -m d12
d13 1 1 c0t0d0s7
d23 1 1 c1t0d0s7
d3 -m d13
d14 1 1 c0t0d0s4
d24 1 1 c1t0d0s4
d4 -m d14
d15 4 c0t1d0s2 c0t2d0s2 c1t1d0s2 c1t2d0s2
d25 4 c0t3d0s2 c1t3d0s2 c1t4d0s2 c1t5d0s2
d5 -m d15
d6 -r c1t6d0s2 c1t8d0s2 c1t9d0s2 -k
————————————————-
Step 4: Run the ‘metainit’ command to create all the metadevices that are listed in the “/etc/lvm/md.tab” file.
# metainit -f -a
Step 5: Run the ‘metaroot’ command to set the metadevice as a root device.
# metaroot d0
Step 6: Add in the other metadevices into the /etc/vfstab file for the other root filesystems as well as the other metadevices.
Step 7:  Reboot the server.
Step 8: You will now attach all the second mirrors to all the mirrored metadevices, for example:
# metattach d0 d20
Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

1 Response

  1. Viki says:

    I thought you have missed one mandatory step, that is after executing installboot for recreate bootblk, need to modify /etc/vfstab before booting without SVM.

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us