Mirror the root disk

Hi all

I wish to mirror for the root disk, but last time i do, make the server cannot boot up. :stuck_out_tongue: So this time, hope you guys can assist me on it. =)
At the last code, is the step i wish to do. Please help to check and correct me if got any wrong.

root@leo # format </dev/null
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
          /pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000011c6a73c58,0
       1. c1t1d0 <SEAGATE-ST314670FSUN146G-0354 cyl 14087 alt 2 hd 24 sec 848>
          /pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000011c6a75d1b,0
......
......
Specify disk (enter its number):

I will like to mirror this two disk. Currently the OS is installed in the c1t0d0

root@leo # vi /etc/vfstab
"/etc/vfstab" 13 lines, 460 characters
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr          ufs     1       yes     -
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c1t0d0s1       -       -       swap    -       no      -
/dev/dsk/c1t0d0s0       /dev/rdsk/c1t0d0s0      /       ufs     1       no
-
swap    -       /tmp    tmpfs   -       yes     -
/devices        -       /devices        devfs   -       no      -
ctfs            -       /system/contract        ctfs    -       no      -
objfs           -       /system/object  objfs   -       no      -
sharefs         -       /etc/dfs/sharetab       sharefs -       no      -
~

Below is the c1t0d0

Warning: Current Disk has mounted partitions.
/dev/dsk/c1t0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c1t0d0s1 is currently used by swap. Please see swap(1M).
partition> p
Current partition table (original):
Total disk cylinders available: 14087 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 - 11670      113.26GB    (11671/0/0) 237528192
  1       swap    wu   11673 - 14086       23.43GB    (2414/0/0)   49129728
  2     backup    wm       0 - 14086      136.71GB    (14087/0/0) 286698624
  3          -    wu       0 - 14086      136.71GB    (14087/0/0) 286698624
  4          -    wu   11671 - 11672       19.88MB    (2/0/0)         40704
  5 unassigned    wm       0                0         (0/0/0)             0
  6 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0

Below is the c1t1d0

partition> p
Current partition table (original):
Total disk cylinders available: 14087 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       2 - 11672      113.26GB    (11671/0/0) 237528192
  1       swap    wu   11673 - 14086       23.43GB    (2414/0/0)   49129728
  2     backup    wu       0 - 14086      136.71GB    (14087/0/0) 286698624
  3          -    wu       2 - 14086      136.69GB    (14085/0/0) 286657920
  4          -    wu       0 -     1       19.88MB    (2/0/0)         40704
  5 unassigned    wm       0                0         (0/0/0)             0
  6 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0

Is it my below step correct ? kindly advise me =)

# prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2
# metadb -a -f -c2 /dev/dsk/c1t0d0s4 /dev/dsk/c1t1d0s4
Mirror the root slice.
# metainit -f d10 1 1 c1t0d0s0
# metainit -f d20 1 1 c1t1d0s0
# metainit d0 -m d10
# metaroot d0
Mirror the swap slice.
# metainit -f d11 1 1 c1t0d0s1
# metainit -f d21 1 1 c1t1d0s1
# metainit d1 -m d11
Update /etc/vfstab
Reboot the system.
# metaroot d0
# lockfs -fa
# init 6
After reboot
# metattach d0 d20
# metattach d1 d21

Correct. try to give at least 50mb for your metadb and have 3 replicas at least, for good practise.
And also remember to change your dump device :- dumpadm -d /dev/md/dsk/d1 and eeprom to point boot-device to "disk disk1"

# dumpadm -d /dev/md/dsk/d1
the dump device is the swap device ?

erm... how about the eeprom??? :slight_smile:

yes, dump device is the swap space
#eeprom boot-device?="disk disk1"

Btw, is your 2 disks of the same size? Did you get any errors when you did prtvtoc? Why aren't the disks of the same type? Just noticed that..

You should install a bootblock on the second disk. On a SPARC machine you use:

/usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0

I think the bootblock is not covered by the SVM sync process.

erm... because previously the two devices is in the veritas group.
may i need to newfs the c1t1d0 first before i create the mirror

You do not need to create a filesystem on the second disk. The resync process will copy the filesystem from the first disk block by block.

Hi, when i run this,
it show me

root@leo # /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0
/dev/rdsk/c1t1d0s0: Not writeable

Can you please check the access mode on the physical device? It should be something like

$ ls -lL /dev/rdsk/c1t1d0s0
crw-r-----   1 root     sys      118,  8 Jan  7 09:11 /dev/rdsk/c1t1d0s0

If you have to change the access mode, find the target of the symbolic link

$ ls -l /dev/dsk/c1t1d0s0
lrwxrwxrwx   1 root     root          70 Nov 17 14:37 /dev/dsk/c1t1d0s0 -> ../../devices/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w2100000c50ac8c6e,0:a

and change owner, group and access mode of that device to root, sys and 640. Then 'installboot' should work.

Yes, the access mode is same as yours. =)
any idea ?
erm... this should run before the mirroring or after ?
coz i haven do the mirroring yet. =)

root@leo # ls -lL /dev/rdsk/c1t1d0s0
crw-r-----   1 root     sys      118,  8 Jun 13  2005 /dev/rdsk/c1t1d0s0
root@leo # ^C
root@leo # ls -l /dev/dsk/c1t1d0s0
lrwxrwxrwx   1 root     root          70 Jun  9  2005 /dev/dsk/c1t1d0s0 -> ../.. /devices/pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000011c6a75d1b,0:a

Strange! 'installboot' is a simple shellscript and one line reads as:

test ! -w $DEVICE && away 1 "$DEVICE: Not writeable"

It seems 'test -w /dev/rdsk/c1t1d0s0' is 'false' on your system.

Are there any errors logged in '/var/adm/messages'? And is the new vtoc already installed on the second disk?

Hi hergp

I think is the my PC and the server connection problem.
after I reconnect to the server again.

it able to run the shellscript

root@leo # /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0
root@leo #

Great !!

Yup.. I forgot to update you on the bootblk installation on the mirror disk . Thanks hergp:)

oh.. The two disks have the same size. below is the output after did the prtvtoc. =)

root@leo # prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2
fmthard:  New volume table of contents now in place.
root@leo # metadb -a -f -c2 /dev/dsk/c1t0d0s4 /dev/dsk/c1t1d0s4
root@leo # metadb
        flags           first blk       block count
     a        u         16              8192            /dev/dsk/c1t0d0s4
     a        u         8208            8192            /dev/dsk/c1t0d0s4
     a        u         16              8192            /dev/dsk/c1t1d0s4
     a        u         8208            8192            /dev/dsk/c1t1d0s4

As per Sun SVM process, there is no need to installbootblk
BigAdmin Submitted Tech Tip: Boot Disk Mirroring Using Solaris Volume Manager Software

But technically speaking, if we want to boot from 2nd disk which is mirrored, we have to install the bootblk on the 2nd HDD.

But my question is that whether Syncing process copy the bootbkl from 1st HDD ==> 2nd HDD ???

Regards,
Vicky

Vicky,I think you are right....
No need to install bootblk .
During sync itself bootblks are copied...

Incorrect. If you want to be able to boot from the second disk the installboot is required.

---------- Post updated at 11:44 PM ---------- Previous update was at 11:42 PM ----------

No it is not copied. Installboot is required.