Wednesday, September 16, 2009

Free RAID! (Mk 2)

Hi all,

As it turns out, the NetBSD-sourced RAIDframe is being phased out of OpenBSD in favour of the internally developed softraid driver. This driver is still under development and lacks a number of user-space tools to make it useful (such as recovery and the like) so once that goes production, I'll blog about it here.

In the meantime, Sun has had a very nicely working framework that, now that they have released OpenSolaris, is now available for free. FreeBSD have integrated it into their system, and it's available in Linux distributions as a user-space fuse driver. Both use the same set of tools that we'll be using here.

First, and foremost, we'll be using VMware again, but this time we'll be using EON (based on Solaris Express CE)as our operating system because it runs in memory and is stripped down enough to fit into memory and still have what you need. I recommend setting a small primary hard drive (2Gb is plenty) and several large SCSI drives. 512MB of RAM will be fine. I created a 2GB primary IDE drive and 9 500GB SCSI drives.

Download an ISO image for EON from the link above, then use it as your CD-ROM drive. Once it boots, log in as root/eonsolaris. There's no need to install just yet - we can play around here without having to install a thing.

Now doing everything in the VMware window makes life fun - especially if it sometimes doubles up your keystrokes like it does for me - so type ifconfig -a to get your IP address (it won't be on lo0, that's for sure - mine showed up as pcn0). SSH in using that address but log in as admin/eonstore (the SSH server won't accept root logins for good reason), then type su - and use the root password to get root access.

Type format to get a list of the drives - if all goes to plan, you should see this:

Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0d0 <default>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
       1. c2t0d0 <default>
          /pci@0,0/pci1000,30@10/sd@0,0
       2. c2t1d0 <default>
          /pci@0,0/pci1000,30@10/sd@1,0
       3. c2t2d0 <default>
          /pci@0,0/pci1000,30@10/sd@2,0
       4. c2t3d0 <default>
          /pci@0,0/pci1000,30@10/sd@3,0
       5. c2t4d0 <default>
          /pci@0,0/pci1000,30@10/sd@4,0
       6. c2t5d0 <default>
          /pci@0,0/pci1000,30@10/sd@5,0
       7. c2t6d0 <default>
          /pci@0,0/pci1000,30@10/sd@6,0
       8. c2t8d0 <default>
          /pci@0,0/pci1000,30@10/sd@8,0
       9. c2t9d0 <default>
          /pci@0,0/pci1000,30@10/sd@9,0
Specify disk (enter its number):


Hit Ctrl+C to cancel out of this and to get back to the prompt. Now that we know what each hard drive is called, we can start creating an array. Let's start with raidz (which is similar to RAID 5 but has variable stripes to avoid the write hole):

eon:3:~#zpool create battery raidz c2t0d0p0 c2t1d0p0 c2t2d0p0 c2t3d0p0 c2t4d0p0 c2t5d0p0 c2t6d0p0 c2t8d0p0 c2t9d0p0
eon:4:~#zpool list
NAME      SIZE  USED  AVAIL    CAP  HEALTH  ALTROOT
battery  4.39T  147K  4.39T    0%  ONLINE  -
eon:5:~#zpool status
  pool: battery
state: ONLINE
scrub: none requested
config:

        NAME          STATE    READ WRITE CKSUM
        battery      ONLINE      0    0    0
          raidz1      ONLINE      0    0    0
            c2t0d0p0  ONLINE      0    0    0
            c2t1d0p0  ONLINE      0    0    0
            c2t2d0p0  ONLINE      0    0    0
            c2t3d0p0  ONLINE      0    0    0
            c2t4d0p0  ONLINE      0    0    0
            c2t5d0p0  ONLINE      0    0    0
            c2t6d0p0  ONLINE      0    0    0
            c2t8d0p0  ONLINE      0    0    0
            c2t9d0p0  ONLINE      0    0    0

errors: No known data errors

And there we are. With one command, we have a 4.3TB drive array. It gets better though - with another command, we can set it up for sharing on CIFS:

eon:6:~#zfs set sharesmb=name=battery,guestok=true battery
eon:7:~#touch /battery/bob

Now, using that IP address, access the Samba share. You should see the file named "bob".

With another command, we can create an NFS export, an iSCSI target (with two commands), even set up swap space.

And that's ZFS in a nutshell. When softraid grows up, I'll cover that in a blog as well. Later days!

No comments:

Post a Comment