Friday, August 19, 2011

Root Mirroring – Solaris Volume Manager

What to do?
1. Ensure that the alternate disk has equal geometry & size.
2. Take backup of /etc/system and /etc/vfstab file.
3. Copy VTOC from root (booting) disk to the alternate disk.
4. Ensure that the state database is created.
5. Convert the root slice as a logical component forcefully.
6. Create another metadevice for duplicating root slice.
7. Convert the swap slice as a logical component forcefully.
8. Create another metadevce for duplicating the swap slice.
9. Associate first sub-mirror (for root) to mirror root.
10. Associate first sub-mirror (for swap) to mirror swap.
11. Update the system & vfstab file by running 'metaroot' command.
12. Reboot the system.
13. Associate the second sub-mirror to mirror root.
14. Associate the second sub-mirror to mirror swap.
15. Install boot block (in case of SPARC machine) or grub (X86 machine) in the alternate root slice
16. See the physical path for the alternate disk
17 Set alias name in the OK prompt.
18. Set boot sequence in OK prompt.

How to do?
1. # format
Create the slices manually.

2. # cp /etc/system /etc/system.orig
   # cp /etc/vfstab /etc/vfstab.orig

3. # prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t12d0s2
fmthard -> populate label on the new hard disk drive

4. # metadb -afc3 c0t8d0s7 c0t10d0s7 c0t12d0s7
(if the replicas are existing, this step can be avoided)

5. # metainit -f d5 1 1 c0t8d0s0  
Converting forcefully the root slice as a metadevice

6. # metainit d10 1 1 c0t12d0s0
Creating another metadevice for root

7. # metainit -f d25 1 1 c0t8d0s1
Converting forceful the swap slice as a metadevice

8. # metainit d30 1 1 c0t12d0s1
Creating another metadevice for swap

9. # metainit d15 -m d5
Associating d5 with d15
Here d15 = main mirror for root

10. # metainit d35 -m d25
Associate d35 with d25
Here d35 = main mirror for swap

11. # metaroot d15
a. 'metaroot' edits the file /etc/system and /etc/vfstab so that the system may be booted with the root filesystem on a meta device.
b. 'metaroot' may also be used to edit the files so that the system may be booted with root file system on a conventional disk device.
c. Observe the changes to the files /etc/vfstab and /etc/system.

12. # init 6
Make sure the sync is completed before rebooting the system
by executing the command # metastat | grep %. It consume some time.

13. # metattach d15 d10
For root adding sub-mirror

14. # metattach d35 d30
For swap adding sub-mirror

15. # cd /usr/platform/`uname -m`/lib/fs/ufs
    # installboot bootblk /dev/rdsk/c0t12d0s0
Installing the boot block to the SPARC machine

# installgrub -fm /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1d0s0
Installing the grub in the X 86 machines.

16. # ls -l /dev/dsk/c0t12d0s0
Will display the physical path of the logical device.
Pls make a note of the physical path.

17. OK nvalias
18. OK setenv boot-device

# metadetach d120 d100
# metaroot c0t0d0s0
c0t0d0s0 = raw disk of source disk which is running with OS.
Will revert the /etc/system & /etc/vfstab to the default status.
# init 6
# metaclear d100
# metaclear -r d120

Amazing Fact


  1. In steps 11 (c)
    1)What are the changes we have to note in both the files?
    2)Changes will occur automatically or manually we have to edit?

  2. Senthilnathan,
    Updates will happen automatically to the file once we execute 'metaroot' command. It update the file in such a way that, the OS has to boot from the mirror disk.

  3. Hi Unknown :),

    Will work on it and post you the same asap.