I’ve seen Solstice Disk Suite mirroring of the system disk that works but is ugly. So I decided to create what I thought was a best practice and try to minimize configuration mistakes. Mirroring the system disk with disk suite with c0t0d0 as the source and c0t1d0 as the destination. Ideally you would have identical disks and a copy of the source disk’s partition table is accomplished with “prtvtoc” and “fmthard” commands.
prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s – /dev/rdsk/c0t1d0s2 | Copy Volume Table of Contents (partition table) from c0t0d0s2 to c0t1d0s2 |
Create the Meta databases.
metadb -af -c 2 /dev/dsk/c0t0d0s7 /dev/dsk/c0t1d0s7 |
Create the root metadevice to be a power of 10 and all subsequent subdisks to be plus 1 or plus 2 for Primary and Secondary subdisks.
metainit -f d11 1 1 c0t0d0s0 | Primary Subdisk (root) |
metainit -f d12 1 1 c0t1d0s0 | Secondary Subdisk (root mirror) |
metainit d10 -m d11 | The -m indicates that the configuration is a mirror. |
cp /etc/vfstab /etc/vfstab.premirror | Make a backup of the /etc/vfstab |
metaroot d10 | Updates /etc/vfstab and /etc/system |
Contents of /etc/system were altered after the metaroot command. Added lines are:
* Begin MDD root info (do not edit) |
forceload: misc/md_trans |
forceload: misc/md_raid |
forceload: misc/md_hotspares |
forceload: misc/md_sp |
forceload: misc/md_stripe |
forceload: misc/md_mirror |
forceload: drv/pcipsy |
forceload: drv/glm |
forceload: drv/sd |
rootdev:/pseudo/md@0:0,1,blk |
* End MDD root info (do not edit) |
Continue creating metadevices for the rest of the partitions
metainit -f d21 1 1 c0t0d0s1 | Primary swap |
metainit -f d22 1 1 c0t1d0s1 | Secondary swap |
metainit d20 -m d21 | |
metainit -f d31 1 1 c0t0d0s3 | Primary /usr |
metainit -f d32 1 1 c0t1d0s3 | Secondary /usr |
metainit d30 -m d31 | |
metainit -f d41 1 1 c0t0d0s4 | Primary /var |
metainit -f d42 1 1 c0t1d0s4 | Secondary /var |
metainit d40 -m d41 | |
metainit -f d51 1 1 c0t0d0s5 | Primary /opt |
metainit -f d52 1 1 c0t1d0s5 | Secondary /opt |
metainit d50 -m d51 |
Editing /etc/vfstab (notice root partition is already done by metaroot)
/dev/dsk/c0t0d0s1 /dev/rdsk/c0t0d0s1 – swap – no – |
/dev/md/dsk/d10 /dev/md/rdsk/d10 / ufs 1 no logging |
/dev/dsk/c0t0d0s3 /dev/rdsk/c0t0d0s3 /usr ufs 1 yes logging |
/dev/dsk/c0t0d0s4 /dev/rdsk/c0t0d0s4 /var ufs 1 yes logging |
/dev/dsk/c0t0d0s5 /dev/rdsk/c0t0d0s5 /opt ufs 2 yes logging |
After editing /etc/vfstab to use metadevices
/dev/md/dsk/d20 /dev/md/rdsk/d20 – swap – no – |
/dev/md/dsk/d10 /dev/md/rdsk/d10 / ufs 1 no logging |
/dev/md/dsk/d30 /dev/md/rdsk/d30 /usr ufs 1 no logging |
/dev/md/dsk/d40 /dev/md/rdsk/d40 /var ufs 1 no logging |
/dev/md/dsk/d50 /dev/md/rdsk/d50 /opt ufs 2 yes logging |
Run the sync command twice. Why twice? Because of buffering by the OS and some disk controllers, control is passed back to the shell once the “filesytem flush” is issued not upon completion. The second sync will effectively wait for the first “fsflush” to finish before executing. #sync; sync Reboot Here! Use “shutdown -r”, “reboot” or “init 6” but NOT “halt”. After rebooting, attach metadevices on the Secondary disk to begin resyncing. Even syncing for the first time is re-syncing.
metattach d10 d12 |
metattach d20 d22 |
metattach d30 d32 |
metattach d40 d42 |
metattach d50 d52 |
– See more at: http://serviceitdirect.com/blog/how-mirror-system-disk-solaris#sthash.9NLVUN1T.dpuf
Tags: Solaris