Adding Software RAID-1 Swap in Solaris 10
Tue 12 May 2009This morning I was tasked with adding an additional 32GB of swap space
to a cluster of ten Sun X4540(thor) systems at work. Doing this by hand
can take a while to be absolutely sure not to break anything
accidentally.
I triple checked the slice mapping on all ten systems making sure the
first free cylinder were the same on all disks.
I did a manual run through of creating the slices using the format
command in solaris.
Once I collected the format command list I created an SDS md
device(software RAID for solaris).
Here s the command list:
partition 4 swap wu 18805 32gb label verify
The two disks to be mirrored on the X4540 are c0t0d0 and c1t0d0. Put the above commands in to a file, in this case formatcmdlist, then run:
format -d c0t0d0 -f /var/tmp/formatcmdlist format -d c1t0d0 -f /var/tmp/formatcmdlist
Now we create the software mirror device, define names for disk slices, and attach them, and activate swap.
metainit d41 1 1 c0t0d0s4 metainit d42 1 1 c1t0d0s4 metainit d40 -m d41 metattach d40 d42 swap -a /dev/md/dsk/d40
Now to make the manual part pay off. I again checked that all systems had free space above cylinder 18804. copied my formatcmdlist to each node with a shell for loop and scp, then ran this big one liner command:
for((i=1;i<10;i++)); do echo "---------host${i}" ; ssh host${i} "format -d c0t0d0 -f /fcmdlist ; format -d c1t0d0 -f /fcmdlist ; metainit d41 1 1 c0t0d0s4 ; metainit d42 1 1 c1t0d0s4 ; metainit d40 -m d41 ; metattach d40 d42 ; swap -a /dev/md/dsk/d40" ; done
Everything worked and the work peeps are happy. It took 20-30 minutes for all of the software mirrors to sync on an idle system. kind of a long time for empty space to sync but hey, it works. :)
So in short, create new disk slices, initialize meta device, add to swap.