DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2007-09-18 02:56:41

MBonner
New member
Registered: 2007-09-18
Posts: 3

External Drive RAID configuration

After a week or so of messing around with the configuration of my DNS-323 I'm getting close to having my external drives configured the way I want. 

I'm currently running a DNS-323 with firmware 1.03 and Fonz's funplug 0.3.

My external USB drives are connected using an AMS T4S box  (http://www.amselectronics.com/product/e … ts/ts.html) which I picked up from Frys (same place I got the DNS-323.)  The T4S supports up to four PATA drives.  It has some built in firmware that allows you to combine the various drives linearly in different configurations, but I decided I preferred to try to go with the uncombined mode and use the linux raid drivers.  My current disk configuration is (scsi4 is the T4S controller):

/ # cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: Maxtor   Model: 6V300F0          Rev: VA10
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: Maxtor   Model: 6V300F0          Rev: VA11
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi4 Channel: 00 Id: 00 Lun: 00
  Vendor: WDC      Model: WD3000JB-00KFA-1 Rev: 08.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi4 Channel: 00 Id: 00 Lun: 01
  Vendor: WDC      Model: WD3000JB-00KFA-2 Rev: 08.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi4 Channel: 00 Id: 00 Lun: 02
  Vendor: WDC      Model: WD3000JB-00KFA-3 Rev: 08.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi4 Channel: 00 Id: 00 Lun: 03
  Vendor: WDC      Model: WD3000JB-00KFA-4 Rev: 08.0
  Type:   Direct-Access                    ANSI SCSI revision: 02

I'm assuming that I'll have better luck at array recovery using the known linux driver rather than trying to mess with the T4S firmware if I have a drive go bad.  I was originally hoping to be able to configure the four drives in a RAID 5 array.  Unfortunately, the existing firmware on the DNS-323 only has compiled in support for linear (JBOD), raid 0 and raid 1 arrays.

/ # cat /proc/mdstat
Personalities : [linear] [raid0] [raid1]
md2 : active raid0 sde1[0] sdf1[1]
      586067072 blocks 64k chunks

md1 : active raid0 sdc1[0] sdd1[1]
      586067072 blocks 64k chunks

md0 : active raid0 sdb2[1] sda2[0]
      583014784 blocks 64k chunks

I'm not sure if RAID 5 support could be added as an optional installable module or if the kernel would need to be rebuilt.  While I've dabbled some in Linux over the years, I'm mainly have a windows technical background.  Does anyone know if the raid5 personality could be added using an insmod .ko?

Anyways, to get the external drives configured for raid, I followed the instructions in the posts about setting up external drives the insmod usb-storage.ko activated sdc, sdd, sde and sdf drives.  Since I had decided to raid the drives using native linux drivers I wanted to stick with a linux file system, which means EXT2 for this firmware version.  I partitioned these drives, created a new partition and created a single type 83 linux parition using all the space on the drives resulting in sdc1, sdd1, sde1 and sdf1 partitions.

Now the somewhat tricky part.  How to set up a raid array and get it to load in funplug.  The mdadm (/usr/sbin/mdadm) application is used to manage raid arrays (well at least it's one way to do that and probably the simplest).  In my case, since raid5 wasn't (yet) an option, I decided on creating two raid0 arrays.

Ok, now things will start to vary depending on how you have your SATA drives raided.  By default the DNS-323 drive image comes configured to support two arrays /dev/md0 and /dev/md1.  I have my two drives configured as a raid0 array using the entire space in the partitions so my configuration is only using md0.  If I had specified to use less than the full available space for the raid0 array, then I believe the DNS-323 would have created a second linear array and assigned that to md1.  With my configuration, MD1 isn't being utilized so I'm free to reuse that.  Since I wanted two additional arrays, I still needed to create another MD2 devices to hold the 2nd array I was going to create.  If both of your MD's are being used, you may need to create a 3rd md device as well.

mknod /dev/md2 b 9 2

This creates the new md2 device I need.  Use

mknod /dev/md3 b 9 3

if you need to make md3, change the 3's to 4's if you need to make md4, etc.  Don't ask me what all the parameters are, I just found the command example and it worked (scary, huh?!?)  Ok, so I have the required md2 device I can go ahead and create the arrays (actually I tried to create them both first and discovered I needed the extra device, but I thoughtfully put the steps in the correct order for you!!!)  Run the following two commands to create the arrays.  You can mix up the devices if you want, I just went sequential since they're all running throught the same usb connection, there shouldn't be any performance difference to rearranging them.  You can also change to --level=1 if you're in love with mirrored configs over striped or you can do --level=linear if you want JBOD concatenation.  If you had to go with md2 and md3 instead then substitute the appropriate device names.

mdadm --create --verbose /dev/md1 --level=0 --raid-devices=2 /dev/sdc1 /dev/sdd1
mdadm --create --verbose /dev/md2 --level=0 --raid-devices=2 /dev/sde1 /dev/sdf1

This results in the two new raid devices (see the cat /proc/mdstat from above).  You can now format these devices (this example is for EXT2):

mke2fs /dev/md1
mke2fs /dev/md2

Choose whatever drive format you want to use, I think the DNS-323 has full VFAT support if you'd rather go that route.  I then hacked up a copy of smb.conf to mount the two new arrays and I went ahead and dropped out the printer support and renamed the volume_1 share as well.  I think I was a thread where someone needed to rename their volume one, this is one way to accomplish that.

Anyways, my hacked up mount-disk.sh (give the a+x attribute so fonz's funplug will run it automatically) and smb.conf are included below.

My final concern at this point is when I try to access the drives over the SMB share, I can read everything fine, but I only have read access to the usb1 and usb2 shares.  From reading other threads, I think this is an issue with my mount command and missing an -o umask=xxx value.  I tried -o umask=0 but then the drives don't mount at all.  Anyone have any idea what umask I should try to get the shares to be read/write?  Or any other ideas if it's not a umask issue?

I hope this helps some of you who are exploring using raid on your external drives.

Thanks...

-- Mike :-)

-------- mount-disk.sh ----------
#!/bin/sh

# see
# "Attaching USB Storage to the DNS-323 for Linux Newbies & Dummies"
# http://dns323.kood.org/forum/viewtopic. … 3221#p3221

#options="-t auto"
#options="-t auto -o umask=0"
disk=sdf1
#mountp=/mnt/HD_a2/$disk

mount_disk_start() {
    insmod ${BINDIR}/modules/$(uname -r)/usb-storage.ko 2>/dev/null
    #insmod ${BINDIR}/modules/$(uname -r)/ntfs.ko        2>/dev/null

    mknod /dev/md2 b 9 2
    mkdir /mnt/HD_usb1
    mkdir /mnt/HD_usb2

        # wait for disk...
    let timeout=60
    while [ ${timeout} -gt 0 ]; do
        grep ${disk} /proc/partitions >/dev/null 2>/dev/null
        [ $? -eq 0 ] && break
        sleep 2
        let timeout=${timeout}-2
    done

    #mkdir -p ${mountp}
    #mount ${options} /dev/${disk} ${mountp} >${mountp}/mount-error.txt 2>&1
    mdadm -A /dev/md1 /dev/sdc1 /dev/sdd1
    mdadm -A /dev/md2 /dev/sde1 /dev/sdf1
    mount /dev/md1 /mnt/HD_usb1
    mount /dev/md2 /mnt/HD_usb2
    cp /mnt/HD_a2/fun_plug.d/etc/smb.conf /etc/samba/smb.conf
    /usr/bin/smb restart
}

mount_disk_stop() {
    #umount ${mountp}
    umount /mnt/HD_usb1
    umount /mnt/HD_usb2
}

mount_disk_status() {
    #mount | grep ${mountp} 1>/dev/null 2>/dev/null
    mount | grep /mnt/HD_usb1 1>/dev/null 2>/dev/null
    if [ $? -eq 0 ]; then
        echo "usb1 array running"
    else
        echo "usb1 array stopped"
    fi
    mount | grep /mnt/HD_usb2 1>/dev/null 2>/dev/null
    if [ $? -eq 0 ]; then
        echo "usb2 array running"
    else
        echo "usb2 array stopped"
    fi
}

case "$1" in
    stop)
        mount_disk_stop
        ;;
    restart)
        mount_disk_stop
        sleep 10 # unplug'ging a disk takes time
        mount_disk_start
        ;;
    status)
        mount_disk_status
        ;;
    start|'')
        mount_disk_start
        ;;
    *)
        echo "Usage: $0 start|stop|restart|status"
        ;;
esac
---------------------------------

------------ smb.conf -----------
[ global ]
client code page = 850
character set = ISO8859-1
workgroup = MBBNET
netbios name = dns323
server string = DNS-323
hosts allow =
hosts deny =
security = SHARE
encrypt passwords = yes
max log size = 0
socket options = TCP_NODELAY SO_RCVBUF=65536 SO_SNDBUF=65536
max xmit = 65535
create mask = 0777
directory mask  = 0777
force create mode = 0777
force directory mode = 0777
load printers = No
use sendfile =yes

[ SATA ]
comment =
path = /mnt/HD_a2
valid users =
read only = no
guest ok = yes

[ USB1 ]
comment =
path = /mnt/HD_usb1
valid users =
read only = no
guest ok = yes

[ USB2 ]
comment =
path = /mnt/HD_usb2
valid users =
read only = no
guest ok = yes
---------------------------------

Offline

 

#2 2007-09-19 10:10:57

MBonner
New member
Registered: 2007-09-18
Posts: 3

Re: External Drive RAID configuration

Anyone have any input on getting the RAID5 personality loaded or suggestions on how to get my USB arrays to mount read/write under SAMBA?

Thanks...

-- Mike :-)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB