Friday May 04, 2007

Createing a RAID-1 (mirror) in Solaris 10 the easy way!

Over the past month I've trialled and errored many times in an attempt to create a simple RAID 1 (Mirror) in Solaris 10 6/06.  I found a bug using a Sun e250 with six 18.3GB SCSI 10K RPM drives (as of 5-4-07) is still not fixed.  It occurs when your '/' partition in on slice '0'. 

After much research this is (in short) what I found:  You can not attach a sub-mirror to a mirror if it resides on slice '0'.  To remedy this, I simply installed swap on slice 0.  That showed it!  ha ha.  Now on the the technical details.  I'm not going to explain what I'm doing, there is a much better reference here for that.  These are simply the directions on how to get the RAID going.

Your drives will very but the slices should be the same.  c#t#d#s7=c1t0d0s7 where # is a variable for whatever number is on your system and c#t##D#s7 would be the second drive with the double '##' symbol.  A good way to find out which drives are available on your system is: 'ls /dev/dsk/' as root.  I'll use '' symbols to specify a specific command or line example:  'init 6'

I think the best part of this is your can effectively RAID your new Solaris 10 box form anywhere in the world via SSH!  That is just plain cool... go Solaris 10!!

*Here is my example partition table on the first (primary) drive, make sure you mind rounding errors*

slice        mount point    size
0             swap               1024 MB      (usually double ram)
1             /                      15360 MB
2             reserve                                  (don't modify this!)
3
4
5
6
7            /metadb             256 MB

Then on drive 2.

slice        mount point    size
0             swap               1024 MB      (gives me 2 swap partitions)
1                                  15360 MB
2             reserve                                  (don't modify this!)
3
4
5
6
7                                 256 MB

*after the install*

*Unmount metadb slice*

umount metadb
rm -R metadb
vi /etc/vfstab     <- delete the metadb line
metadb -a -f -c2 /dev/dsk/c#t#d#s7 /dev/dsk/c#t#d#s7 

*Forcing a mirror creation on root, you must use the '-f' flag for any mounted file system*
root - /
metainit -f d1 1 1 c#t#d#s1
metainit d2 1 1 c#t##d#s1
metainit d0 -m d1
metaroot d0

*If you don't need mirrored swap don't do it, you'll get better performance*
all your swap
metainit -f d11 1 1 c#t#d#s0
metainit d12 1 1 c#t##d#s0
metainit d1 -m d11

Edit '/etc/vfstab'
The root line should be:

'/dev/md/dsk/d0 /dev/md/rdsk/d0' (you might not have to add this, depends on your version of Solaris 10)
'/dev/md/dsk/d1'    <- swap if mirrored

*then we...

lockfs -fa
init 6 (if it doesn't reboot cleanly you start over, I recommend creating a flar image first...)

*It comes back up!
metattach d0 d1
metattach d1 d12
metastat

**This is the last step.... don't do it till you've done everything above this line FIRST!!**
'installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c#t##d#s1'  <- your second disk (sub-mirror)

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed