Monday Mar 24, 2008

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 d11 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:

huh?

$ cat /etc/release
Solaris 10 6/06 s10s_u2wos_09a SPARC
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 09 June 2006

$ df -k /
Filesystem kbytes used avail capacity Mounted on
/dev/md/dsk/d0 8262869 3648932 4531309 45% /

$ metastat d0 | grep c1
c1t0d0s0 0 No Okay Yes
c1t1d0s0 0 No Okay Yes
c1t0d0 Yes id1,sd@SSEAGATE_ST973401LSUN72G_0510EYE5____________3LB0EYE5
c1t1d0 Yes id1,sd@n500000e012122910

So there's a sol10 6/06 system with a mirrored / on slice 0. No bug here.

Also, your example shows using "d1" as a submirror of d0, but also as swap. So I'm lead to believe the bug is operator error, not a solaris bug.

finally, you don't need to do an installboot on the 2nd disk after mirroring - you just setup a mirror of the root filesys, which *includes* the boot block. So it's already there. Also, notice in the linked Sun root mirroring documentation there's no mention of installboot...

Posted by 209.210.14.1 on May 21, 2008 at 05:45 PM CDT #

As far as the bug goes, all I know is I followed the above directions and I could not build a successful RAID while / was on slice 0. I put swap on 0 and / on 1 everything worked. . . I googled around and found other people having the same issues, perhaps it's hardware specific?

You also found a typo in my document: 'metattach d1 d12' should be 'metattach d11 d12'.

As for installboot, that is used to make the second drive bootable in the event of the first drive going down. As I understand it, the RAID creates an active non-botable RAID of the other drive, the installboot command makes the second drive of the RAID bootable. I believe this step is nesscary when RAIDing an X86-64 system, I'm not 100% sure if it's needed for SPARC or not (I seem to think it was at one time). . . I used it, and it didn't hurt (and it booted off the second drive).

"Install bootblocks on the secondary submirror in order to make it bootable.
Slice 8 on the disk where the secondary submirror resides is necessary for booting the Solaris OS from this fdisk partition. This slice holds the partition boot record (pboot), the Solaris VTOC for the disk, and the bootblock. This information is disk specific, so it is not mirrored with Solaris Volume Manager. However, you must ensure that both disks are bootable so that you can boot from the secondary disk if the primary fails. Use the installboot command to setup the second disk as a Solaris bootable disk. See the installboot(1M) man page for more information." --

http://docs.sun.com/app/docs/doc/816-4520/tasks-mirrors-21?a=view

Thanks for the feedback and finding the typo!

Posted by Andrew on May 21, 2008 at 08:22 PM CDT #

Post a Comment:
  • HTML Syntax: NOT allowed