Wednesday, October 8, 2008

How to do root mirroring with SVM ?

This document explains how to do root mirroring using SVM.


Setup : root disk is dev/rdsk/c0t0d0
To be mirrored on dev/rdsk/c011d0

Create sama partition on both drive


1. prtvtoc /dev/rdsk/c0t0d0s2 > oldparttable

2. fmthard –s oldparttable /dev/rdsk/c0t11d0s2

Format all partion to be mirrored on. In this case

newfs /dev/rdsk/c0t11d0s0
newfs /dev/rdsk/c0t11d0s1
newfs /dev/rdsk/c0t11d0s3
newfs /dev/rdsk/c0t11d0s4
newfs /dev/rdsk/c0t11d0s5
newfs /dev/rdsk/c0t11d0s6
newfs /dev/rdsk/c0t11d0s7

Create replica databse.

metadb -a -c 3 -f c0t0d0s7 c0t11d0s7

Check meta database

bash-3.00# metadb
flags first blk block count
a u 16 8192 /dev/dsk/c0t0d0s7
a u 8208 8192 /dev/dsk/c0t0d0s7
a u 16400 8192 /dev/dsk/c0t0d0s7
a u 16 8192 /dev/dsk/c0t11d0s7
a u 8208 8192 /dev/dsk/c0t11d0s7
a u 16400 8192 /dev/dsk/c0t11d0s7


Create one way partition:


metainit -f d11 1 1 c0t0d0s0
metattach d10 -m d11
metainit d10 -m d11
metaroot d10

more /etc/vfstab

Create same for /var partition

metainit -f d21 1 1 c0t0d0s4
metainit d22 1 1 c0t11d0s4
metattach d20 -m d21

Check status

metastat -p

cp vfstab vfstab.bak
vi vfstab

more /etc/system

Check boot path

eeprom


boot-device=/pci@1f,4000/scsi@3/disk@0,0:a /pci@1f,4000/scsi@3/disk@b,0:a disk net


Note down boot slice path as follows:

bash-3.00# ls -al /dev/dsk/c0t0d0s0

lrwxrwxrwx 1 root root 41 Sep 15 00:26 /dev/dsk/c0t0d0s0 -> ../../devices/pci@1f,4000/scsi@3/sd@0,0:a

bash-3.00# ls -al /dev/dsk/c0t11d0s0

lrwxrwxrwx 1 root root 41 Sep 15 00:26 /dev/dsk/c0t11d0s0 -> ../../devices/pci@1f,4000/scsi@3/sd@b,0:a

Record the string that follows the /devices directory

i.e /pci@1f,4000/scsi@3/sd@b,0:a

ok> nvalias backup_root /pci@1f,4000/scsi@3/disk@b,0

ok> setenv boot-device disk backup-root net


/pci@1f,4000/scsi@3/sd@b,0:a


nvunalias backup_root /pci@1f,4000/scsi@3/sd@b,0:a ===> This is not working even though it is per SUn DOcument. ....

ok devalias
backup_root /pci@1f,4000/scsi@3/sd@b,0:a
disk5 /pci@1f,4000/scsi@3/disk@c,0
disk4 /pci@1f,4000/scsi@3/disk@b,0
disk3 /pci@1f,4000/scsi@3/disk@a,0
disk2 /pci@1f,4000/scsi@3/disk@9,0
disk1 /pci@1f,4000/scsi@3/disk@8,0
disk0 /pci@1f,4000/scsi@3/disk@0,0
disk /pci@1f,4000/scsi@3/disk@0,0
scsi /pci@1f,4000/scsi@3
cdrom /pci@1f,4000/scsi@3/disk@6,0:f
tape /pci@1f,4000/scsi@3/tape@4,0
pcia /pci@1f,2000
pcib /pci@1f,4000
pci0 /pci@1f,4000
flash /pci@1f,4000/ebus@1/flashprom@10,0
nvram /pci@1f,4000/ebus@1/eeprom@14,0
parallel /pci@1f,4000/ebus@1/ecpp@14,3043bc
net /pci@1f,4000/network@1,1
ebus /pci@1f,4000/ebus@1
i2c /pci@1f,4000/ebus@1/SUNW,envctrltwo
floppy /pci@1f,4000/ebus@1/fdthree
tty /pci@1f,4000/ebus@1/se@14,400000


ok> boot disk4


And this works for me. Hope you will make this working.

No comments: