Disclaimer: changing disk labels can be dangerous. Please backup any data before attempting this.
Software raid is usually quite simple to setup on Solaris 10 if doing
so from scratch. What isn't so easy is mirroring an existing disk to a
new disk if you have no space left for creating the slices to hold the
state databases. Solaris 10 would not let me resize the swap on the fly
(I'm sure older versions used to allow this). So in order to free up
some space the following was necessary:
Format the second disk
Copy the disk label from the first disk (the one with the partitions already defined) to the second disk (the new blank one)
Now resize the swap partition on the second disk and create two small slices (40mb will do) to hold the state databases
When happy with the new slices copy the disk label from the second disk to the first (overwriting the old label)
Then you can create the state databases on the two new slices using the metadb command
Continue with the software raid setup as usual
Initial partition layout of disks
Part Tag Flag Cylinders Size Blocks
0 root wm 1237 - 3215 9.60GB (1979/0/0) 20138304
1 swap wu 0 - 1236 6.00GB (1237/0/0) 12587712
2 backup wm 0 - 14086 68.35GB (14087/0/0) 143349312
3 unassigned wm 3216 - 13520 50.00GB (10305/0/0) 104863680
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 var wm 13521 - 13933 2.00GB (413/0/0) 4202688
7 unassigned wm 0 0 (0/0/0) 0
Format the second disk
Format, select 1, say yes to label, quit.
Copy the disk label from the first disk to the mirror disk
prtvtoc -h /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2
Steal some of swap so that there is space for partitions 4 and 5
Part Tag Flag Cylinders Size Blocks
0 root wm 1237 - 3215 9.60GB (1979/0/0) 20138304
1 swap wu 0 - 1220 5.92GB (1221/0/0) 12424896
2 backup wm 0 - 14086 68.35GB (14087/0/0) 143349312
3 unassigned wm 3216 - 13520 50.00GB (10305/0/0) 104863680
4 unassigned wm 1221 - 1228 39.75MB (8/0/0) 81408
5 unassigned wm 1229 - 1236 39.75MB (8/0/0) 81408
6 var wm 13521 - 13933 2.00GB (413/0/0) 4202688
7 unassigned wm 0 0 (0/0/0) 0
Copy the disk label from the mirror disk to the current disk (resizes swap)
prtvtoc -h /dev/rdsk/c1t1d0s2 | fmthard -s - /dev/rdsk/c1t0d0s2
Create the state databases on slices 4 and 5 on each disk
metadb -a -f -c3 c1t0d0s4 c1t0d0s5 c1t1d0s4 c1t1d0s5
Add the root volume to a mirror
metainit -f d1 1 1 c1t0d0s0 #Make this a raid volume
metainit -f d2 1 1 c1t1d0s0 #Also make the mirror slice a raid volume
metainit d0 -m d1 #Add the mounted slice to the raid group d0
Make the root partition bootable
metaroot d0
Mirror the other volumes (/zones, Var and SWAP)
metainit -f d4 1 1 c1t0d0s4
metainit -f d5 1 1 c1t1d0s4
metainit d3 -m d4
metainit -f d7 1 1 c1t0d0s6
metainit -f d8 1 1 c1t1d0s6
metainit d6 -m d7
metainit -f d10 1 1 c1t0d0s1
metainit -f d11 1 1 c1t1d0s1
metainit d9 -m d10
Update the /etc/vfstab
/dev/md/dsk/d9 - - swap - no -
/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no logging
/dev/md/dsk/d6 /dev/md/rdsk/d6 /var ufs 1 no logging
/dev/md/dsk/d3 /dev/md/rdsk/d3 /zones ufs 2 yes logging
Reboot
lockfs -fa && init 6
Add the submirrors
metattach d0 d2
metattach d3 d5
metattach d6 d8
metattach d9 d11
Update the boot loader
stop + a
setenv boot-device disk0 disk1
nvstore
go
Update the crashdump device
dumpadm -d /dev/md/dsk/d9
