Tuesday, 16 October 2012

SVM ROOT MIRRORING



c1t0d0 —> Root disk
c1t1d0 —> Root-mirror disk
Sub mirrors for Root disk —> d10, d20
Sub mirrors for Root-mirror disk —> d11, d21
Mirror name would be —> d0, d1  (root, swap)

1.     Need to take the backup of required files
#cp /etc/system /etc/system.bkp
#cp /etc/vfstab /etc/vfstab.bkp
#df -h>df.bkp
#echo|format>format.bkp
2.     We have to select the new disk as same geometry of root disk, and also need to label the new disk by using root disk
# fmthard -s /dev/null /dev/rdsk/c1t1d0s2  [empty labeling on new disk]
#prtvtoc /dev/rdsk/c1t0d0s2|fmthard -s - /dev/rdsk/c1t1d0s2 [labeling new disk]
3.     Need to create 3 meta database replicas on each disk [should allocate 50MB for 7th slice on each disk, and no need run newfs]
# metadb -a -f -c 3 /dev/rdsk/c1t0d0s7
# metadb -a -f -c 3 /dev/rdsk/c1t1d0s7
#metadb   [to check metadb values]
4.     Create RAID-0 volumes on root disk for sub-mirrors
# metainit -f d10 1 1 c1t0d0s0    [for root]
# metainit -f d20 1 1 c1t0d0s1    [for swap]
5.     Create second RAID-0 volumes on root-mirror disk for sub-mirrors
# metainit -f d11 1 1 c1t1d0s0
# metainit -f d21 1 1 c1t1d0s1
6.     Create RAID-1 one-way mirror volumes using RAID-0 volumes on root disk
# metainit -f d0 -m d10
# metainit -f d1 -m d20
7.     Execute “metaroot” command on root mirror volume, and it will update the /etc/system file & /etc/vfstab file
Note: Before executing “metaroot” just check system & vfstab for knowing difference after this
        #metaroot d0
NOTE: Check /etc/vfstab & /etc/system files, and above command will update only for root file system with “md” entries for rest of other file systems(i.e., swap, usr, var etc..) we need to made it as manual “md” entries.
        #cat /etc/vfstab
            /dev/dsk/c1t0d0s1               -                           -       swap    -        no      -
             /dev/md/dsk/d0      /dev/md/rdsk/d0  /       ufs       1        no      -
         #vi /etc/vfstab   [need to change with “md” entries for other FS]
            /dev/md/dsk/d1               -                   -       swap    -        no      -
             /dev/md/dsk/d0      /dev/md/rdsk/d0  /       ufs       1        no      -

8.     For file system level alters, we must reboot the system[i.e. will effect in df –h with md entries]
 #shutdown –y –g0 –i6
9.     Once system came up, need to attach second submirrors to main mirror
#metattach d0 d11
#metattach d1 d21
Check the status of syncing
#metastat|grep –i sync
10.  Install “bootblk” on root mirrored disk
#installboot /usr/platform/`uname –i`/lib/fs/ufs/bootblk  /dev/rdsk/c1t1d0s0
#prtconf -pv | grep -i bootpath
                 bootpath:  '/pci@1f,0/pci@1/scsi@8/disk@0,0:a'
NOTE: for x86 systems old versions [should be on s2 slice]
#installboot /usr/platform/i86pc/lib/fs/ufs/pboot \
/usr/platform/i86pc/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s2
------------------------------------------------------------------------------------------------------------------------
NOTE: From Solaris 10 x86 U1 version, the installboot command is obselete. So, use the installgrub command, to make the second disk bootable. It is better to run this command once, to make sure the secondary disk is bootable.
# installgrub -fm /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1t1d0s0
11.  Record second submirror name from event of failures
#eeprom boot-device
        boot-device=rootdisk  net
#ls -l /dev/dsk/c1t1d0s0
     /pci@1f,0/pci@1/scsi@8/sd@1,0:a
Ok>       [stop+A]
Ok> show-disks                       [select the root-mirror disk  ]
Ok>nvalias root-mirror  /pci@1f,0/pci@1/scsi@8/disk@1,0:a
NOTE: needs to boot with each drive for testing
Ok>setenv boot-device rootdisk root-mirror net
Ok>printenv boot-device
    rootdisk   root-mirror   net
Ok>boot
NOTE: x86 systems
# eeprom bootpath
bootpath=/pci@0,0/pci15ad,1976@10/sd@0,0:a
# ls -l /dev/dsk/c1t1d0s0
lrwxrwxrwx   1 root     root          46 Feb  7 16:48 /dev/dsk/c1t1d0s0 -> ../../devices/pci@0,0/pci15ad,1976@10/sd@1,0:a
# eeprom altbootpath=/pci@0,0/pci15ad,1976@10/sd@1,0:a
NOTE: Booting with 50% of available replicas is possible/optional with the /etc/system setting “set md:mirrored_root_flag=1” i.e to maintain quorum also add the mentioned line in /etc/system file.
UNMIRRORING PROCEDURE
1.     Un-record second sub-mirror from “boot-device”
2.     Need to detach root-mirror disk sub-mirrors from main mirror
#metadetach d0 d11   [for root]
#metadetach d1 d21   [for swap]
3.     Execute metaroot on root file system block device
#metaroot /dev/dsk/c1t0d0s0
Check /etc/vfstab & /etc/system file, and above command will update for root FS
#grep c1t0d0s0 /etc/vfstab
/dev/dsk/c1t0d0s0  /dev/rdsk/c1t0d0s0  /   ufs   1   no  -
NOTE: For other File systems[swap,opt,usr], and we need to edit manually, and make it as native entries
NOTE: Here's the caveat(caution) for mirrored swap - you're probably using /dev/md/dsk/d1 for your dump device. Let's fix that now. First run
dumpadm | grep '/md/'
If that returns any output, then run this (using your single-disk slice for swap):
dumpadm -s /var/crash/`hostname` -d /dev/dsk/c1t0d0s1

4.     Reboot the system
#shutdown –y –g0 –i6
5.     Now, we can clear main mirror as well as sub-mirror under root disk
#metaclear –r d0
#metaclear –r d1
Flipkart.com

No comments:

Post a Comment

Note: only a member of this blog may post a comment.