Setting up a mirror of your root filesystem in 10 steps
Read man pages for all the commands below for more info.
You’ll need a partition at least as big as your / (root partition) and at least 3 other partitions with a free space of at least 5 MB. Preferably, create at least 3 small partitions a couple of MB in size, on different disks on different controllers (which are preferably not a part of your mirror or RAID setup), holding the state database replica’s. In the example, the root partition is c0t0d0s0 and the mirror partition is c0t2d0s4.
Create the state databases:
metadb -f -a /dev/rdsk/c1t3d0s7
metadb -a /dev/rdsk/c2t4d0s7
metadb -a /dev/rdsk/c3t5d0s7
Initialize a RAID 0 with 1 stripe on your root partition:
metainit -f d11 1 1 /dev/rdsk/c0t0d0s0
The same on the mirror partition:
metainit d12 1 1 /dev/rdsk/c0t2d0s4
Initialize the mirror:
metainit d10 -m d11
Reflect this change in /etc/vfstab (this command will edit your vfstab):
Reboot your system so that it rereads /etc/vfstab.
Connect the mirror partition to your mirror:
metattach d10 d12
Issue the metastat command to see that this works, give the mirror time to synchronize.
In the openbootprom, create an alias for the mirror partition, so you can boot from it in case of emergency:
OK nvalias mirror /pci@1f,0/ide@d/disk@2,0:e
Read the OpenBoot FAQ for information on device trees, the above line is architecture dependent!
Add this alias to the list of boot devices:
OK boot-device disk mirror
Test your mirror:
OK boot mirror
Note: Volume Manager complains if it needs to mirror on an s0 that starts at cylinder 0. Therefor, have your first partition start at cylinder 1 if you need it as second part of a mirror.