Pages

Wednesday, January 19, 2011

How to mirror root file system on SPARC system

You can mirror root disk with Solaris Volume manager. This is useful to protect your root file system. Root file system (/) is a critical file system that need to be cared well. For eample you have a root disk with partition 0 is belong to root (/) file system. You can mirror this root disk to other disk with following steps:

  1. Check your root file system is mounted from your root disk. In this example you use c0t0d0s0 as your root filesystem.
    bash-3.00# df -k /
    Filesystem size used avail capacity Mounted on
    /dev/dsk/c0t0d0s0 14G 8.9G 5.4G 63% /
  1. Create 2 metadevices that you will use as submirror. In this example you create d11 and d12.
    bash-3.00# metainit -f d11 1 1 c0t0d0s0
    d11: Concat/Stripe is setup
    bash-3.00# metainit d12 1 1 c3t4d0s0
    d12: Concat/Stripe is setup
  1. Create the mirror. In this example you create mirror d1 use metadevice d11 as submirror
    bash-3.00# metainit d1 -m d11
    d1: Mirror is setup
  1. Backup the affected file. Then set your mirror device d1 as your root filesystem. Check also that your root file system is now mounted from the mirror.
    bash-3.00# cp /etc/system /etc/system.bck
    bash-3.00# cp /etc/vfstab /etc/vfstab.bck
    bash-3.00# metaroot d1
    bash-3.00# more /etc/vfstab
    #device device mount FS fsck mount mount
    #to mount to fsck point type pass at boot options
    #
    /dev/md/dsk/d1 /dev/md/rdsk/d1 / ufs 1 no -

  1. Reboot your system. Synchronize file systems before you reboot.
    bash-3.00# lockfs -a
    bash-3.00# init 6
  2. Verify that your system now using mirror d1 as root filesystem.
    bash-3.00# df -h /
    Filesystem size used avail capacity Mounted on
    /dev/md/dsk/d1 14G 8.9G 5.4G 63% /
  1. Attach the second submirror d12 to the mirror.
    bash-3.00# metattach d1 d12
    d1: submirror d12 is attached
  1. Check your mirror. Now it is resyncing

bash-3.00# metastat
d1: Mirror
Submirror 0: d11
State: Okay
Submirror 1: d12
State: Resyncing
Resync in progress: 4 % done
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 30732345 blocks (14 GB)

d11: Submirror of d1
State: Okay
Size: 30732345 blocks (14 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s0 0 No Okay Yes


d12: Submirror of d1
State: Resyncing
Size: 31391010 blocks (14 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c3t4d0s0 0 No Okay Yes


Device Relocation Information:
Device Reloc Device ID
c3t4d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB238eb2cf-1b6348b6
c0t0d0 Yes id1,cmdk@AVBOX_HARDDISK=VBceae357c-d2e0a4a0

  1. Determine the path of second submirror, then enter OK prompt
    bash-3.00# ls -l /dev/dsk/c3t4d0s0
lrwxrwxrwx 1 root root 57 Oct 25 11:22 /dev/dsk/c3t4d0s0 -
> ../../devices/pci@1f,0/pci@1/pci@1/SUNW,isptwo@4/sd@4,0:a
bash-3.00# init 0
  1. Make the second submirror bootable.
    ok nvalias mirror_disk /pci@1f,0/pci@1/pci@1/SUNW,isptwo@4/sd@4,0:a
  2. Make alias for the second submirror. So you can boot from the second sub mirror.
    ok printenv boot-device
boot-device= disk net
ok setenv boot-device disk mirror_disk net
boot-device= disk mirror_disk net
  1. (Optional) after resyncing process on step 8 is done, you can try to boot from the second submirror.
    ok boot mirror_disk

No comments:

Post a Comment