# format c0t0d0
Use the partition tool (=> “p <enter>, p <enter>”!) to setup the slices. We assume the following slice setup afterwards:
0 root wm 870 – 7389 14.65GB (6520/0/0) 30722240
1 swap wu 0 – 869 1.95GB (870/0/0) 4099440
2 backup wm 0 – 7505 16.86GB (7506/0/0) 35368272
3 unassigned wm 7390 – 7398 20.71MB (9/0/0) 42408
4 unassigned wm 0 0 (0/0/0) 0
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
# prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s – /dev/rdsk/c0t1d0s2
2. Create at least two state database replicas on each disk
# metadb -a -f -c 2 c0t0d0s3 c0t1d0s3
Check the state of all replicas with metadb:
# metadb
Notes:
* A state database replica contains configuration and state information about the meta devices. Make sure that always at least 50% of the replicas are active!
3. Create the root slice mirror and its first submirror
# metainit -f d10 1 1 c0t0d0s0
# metainit -f d20 1 1 c0t1d0s0
# metainit d30 -m d10
Run metaroot to prepare /etc/vfstab and /etc/system (do this only for the root slice!):
# metaroot d30
4. Create the swap slice mirror and its first submirror
# metainit -f d11 1 1 c0t0d0s1
# metainit -f d21 1 1 c0t1d0s1
# metainit d31 -m d11
5. Edit /etc/vfstab to mount all mirrors after boot, including mirrored swap
/etc/vfstab before changes:
fd – /dev/fd fd – no –
/proc – /proc proc – no –
/dev/dsk/c0t0d0s1 – – swap – no –
/dev/md/dsk/d30 /dev/md/rdsk/d30 / ufs 1 no logging
swap – /tmp tmpfs – yes –
/etc/vfstab after changes:
fd – /dev/fd fd – no –
/proc – /proc proc – no –
/dev/md/dsk/d31 – – swap – no –
/dev/md/dsk/d30 /dev/md/rdsk/d30 / ufs 1 no logging
swap – /tmp tmpfs – yes –
Notes:
* The entry for the root device (/) has already been altered by the metaroot command we executed before.
6. Reboot the system
# lockfs -fa && init 6
7. Attach the second submirrors to all mirrors
# metattach d30 d20
# metattach d31 d21
Notes:
* This will finally cause the data from the boot disk to be synchronized with the mirror drive.
* You can use metastat to track the mirroring progress.
8. Change the crash dump device to the swap metadevice
# dumpadm -d `swap -l | tail -1 | awk ‘{print $1}’
9. Make the mirror disk bootable
# installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t1d0s0
Notes:
* This will install a boot block to the second disk.
10. Determine the physical device path of the mirror disk
# ls -l /dev/dsk/c0t1d0s0
… /dev/dsk/c0t1d0s0 -> ../../devices/pci@1f,4000/scsi@3/sd@1,0:a
11. Create a device alias for the mirror disk
# eeprom “nvramrc=devalias mirror /pci@1f,4000/scsi@3/disk@1,0”
# eeprom “use-nvramrc?=true”
Add the mirror device alias to the Open Boot parameter boot-device to prepare the case of a problem with the primary boot device.
# eeprom “boot-device=disk mirror cdrom net”
You can also configure the device alias and boot-device list from the Open Boot Prompt (OBP a.k.a. ok prompt):
ok nvalias mirror /pci@1f,4000/scsi@3/disk@1,0
ok use-nvramrc?=true
ok boot-device=disk mirror cdrom net