NSLU2-Linux
view · edit · print · history

How to add multiple EXT3 drives to your NSLU2

I have yet to see a wiki on how to setup three or more drives on an Unslung NSLU2. Here's my attempt to help out the newbies (like me) to get more storage out of your slug. Please update the wiki with your findings if there is an error, as I'm writing this from memory.

My setup:

  • Linksys NSLU2 (de-underclocked) running V2.3R63-uNSLUng-6.8-beta (no additional packages installed)
  • Unslung to an I/O Magic USB enclosure (I35USBEN) with a 200gb IDE Maxtor. Connected to the USB port labeled "USB Disk 2".
  • Linksys USB2HUB4 connected to the USB port labeled "USB Disk 1".
  • I/O Magic USB enclosure (I35USBEN) with an IDE 200gb Maxtor formatted EXT3
  • Western Digial 250gb Mybook external drive formatted EXT3

Extras:

  • An old case fan wired 5 volt to the USB Hub to cool the aluminum drives (works really well and is completely silent).
  • Linksys WRT54G running DD-Wrt (not really relevant).
  • Old school rubber mouse pad turned upside down for the drives to sit on (eliminates any vibration)

Handy commands and links:

Step 1: (As seen on www.nslu2-linux.org)

Unsling your NSLU2 to an external drive. I had problems with flash drives locking up the slug, so I now use a hard drive for the OS.

Step 2: (As seen on www.knoppix.org)

Format all your storage drives EXT3. I used a bootable Knoppix disc on my pc to get the job done and had the entire drive as one partition. You will have to do some Google searching to find the correct format command options. I will try to update the wiki later with them.

  • it is strongly recommended, that you check your temporary added disks careful. If you use the wrong disk with the following commands, you may destroy their contents ***

Step2.1:

Use fdisk to partition your new disks:

 fdisk /dev/sdc       # replace the letter 'c' with your drive letter, 
                      # older kernels may use 'hd' instead of 'sd'
 ...
 Command (m for help):

with 'p' you can get a list of your current partition table, 'd' will delete partitions, 'n' will create a new partition. Entering 'w' will write the partition table and exit the fdisk utility. ('q' will leave the utility without saving the changes)

Step2.2:

Create the filesystem for each partition:

 /sbin/mkfs.ext3 /dev/sdc1    # use your drive name

or

 /sbin/mke2fs -j /dev/sdc1    # the difference between ext2 and ext3 filesystems 
                              # is the addition of the journaling functionality on ext3

Step2.3:

Run a first filesystem check:

 /sbin/fsck.ext3 /dev/sdc1    # use your drive name

Step 3:

Connect the storage drives to the USB Hub. I currently have two storage drives connected to my usb hub, and one to the slug.

Step 4:

Configure Unslung to mount your drives and create the shares at bootup.
Create folders to mount the storage drives. They should go under /share. I also created two folders on the root of the unslung 200gb for storage since I had it available.

	cd share
	mkdir storage1
	mkdir storage2
	cd ..
	mkdir music_videos  	<-optional esp. if you unslung to a small drive
	mkdir music		<-optional esp. if you unslung to a small drive

Use /unslung/rc.local to mount the storage drives to the folders you created.

	cd unslung
	vi rc.local

With the text editor add these three lines:

	/bin/mount -t ext3 /dev/sdb1 /share/storage1 -o rw,noatime
	/bin/mount -t ext3 /dev/sdc1 /share/storage2 -o rw,noatime
	return 1

With my setup sdb1 was my (storage1) 200gb Maxtor drive and sdc1 was my (storage2) 250gb WD drive (YMMV). I believe that additional drives will follow the same order (ie. sdd1, sde1, etc.)

To create the shares at bootup edit etc/samba/user_smb.conf
As you can see from my setup I have four shares that get created. I also turn off the two built-in shares from being viewed at the bottom.

The TV share is the 250gb WD drive dedicated to storing tv shows. The movies share is the 200gb Maxtor drive. I also created two more shares that are on the unslung 200gb that we created above for music and music videos. Valid user groups are what you created in the Web Console. I have TV, Movies, and Music videos folders setup so the "Video" goup has read access, and the "Administrators" group read/write. The Music folder is "Everyone" read, and "Administrators" read/write.

	cd etc/samba
	vi user_smb.conf

Put these lines in with the text editor:

	[TV]
	valid users=@"administrators",@"video"
	comment=TV Shows
	path=/share/storage2
	browsable=yes
	read only=yes
	write list=@"administrators"

	[movies]
	valid users=@"administrators",@"video"
	comment=Movies
	path=/share/storage1
	browsable=yes
	read only=yes
	write list=@"administrators"

	[music videos]
	valid users=@"administrators",@"video"
	comment=Music Videos
	path=/share/flash/data/music_videos
	browsable=yes
	read only=yes
	write list=@"administrators"

	[music]
	valid users=@"administrators",@"everyone"
	comment=Music
	path=/share/flash/data/music
	browsable=yes
	read only=yes
	write list=@"administrators"

	[ADMIN 2]
	browsable=no

	[DISK 2]
	browsable=no

I think that should be all you need to configure. Type DO_Reboot and the shares should be there after the reboot! I can't remember how I setup the file permissions for the folders, so you may have to play around with permissions if you don't get read/write access like you should. I can't remember if I even needed to.

Edit: I needed to give the everyone group rwx (read,write,execute) access to my directories (ie. /share/storage1)

 chown root:everyone folder_name

 chmod g=rwx folder_name

The share permissions will stop any unauthorized access to these folders (correct me if I'm wrong, but that's the way it worked out for me).

Additional Notes by SRS:

I have configured several NSLU2 units with multiple Ext3 drives on a hub which include a SINGLE Native Ext3 and up to 3 additional NON-Native Ext3 drives with complete success. Here are my notes and I hope this will help others.

   I formatted the drive(s) to Ext3 with DOS/Windows software Partition Commander
   instead of using linux fdisk.

   Use /share/ directory to mount storage drive(s)

   Before physically mounting the drive(s) first chmod the created mount
   point to 777 then after the drive is mounted chmod your mount point to
   whatever you desire. Make sure to create the initial mount point directory
   within linux (NOT with FTP) so that the group and owner are
   initially set to root.

   chmod 755 /unslung/rc.local  so that the rc.local file is given the
   proper read and execute attributes. Had locked boot up and booting
   without mounting when permissions were 600, as I remember.

Use /share/ directory to mount storage drive(s)

   DO NOT --> Create folders to mount storage drive(s) inside
   /share/hdd/data/ [i.e. within the 'data' directory] UNLESS
   you will be having the new non-native ExT3? on a hub with at least one
   FAT, FAT32?, ?NTFS?->(not tested), NATIVE-ExT3?.

   /share/hdd/ directory  also seems OK.

   It is preferable NOT to mount inside /share/hdd/data/ but it will function
   properly once set up correctly.
   If you must note the below pitfalls also: 


   The system AUTOMATICALLY changes the permissions on the 'data' directory
   to  - 700 root root -  if 'data' exists AND there is a NON-Native
   ExT3? in USB Port 1 (or ?just a single NON-Native in a hub usb port 1? not tested)
   (or ? no drive at all usb port 1? not tested).

   The system does not automatically create 'data' unless at least one
   FAT, FAT32?, ?NTFS?->(not tested), NATIVE-ExT3? is present and then the permissions
   will be good. However if YOU create the /share/hdd/data/ directory
   because it does not exist
   [because *NO*  FAT, FAT32?, ?NTFS?->(not tested), NATIVE-ExT3? is present]
   OR 'data' existed previously and now there is no longer
   at least one FAT, FAT32?, ?NTFS?->(not tested), NATIVE-ExT3? present
   THEN after a reboot the permissions of 'data'
   are forced to 700 root root.

   With 700 some FTP accounts can't read/write the 'data' directory.

   Before physically mounting the drive(s) first chmod the created mount
   point to 777 then after the drive is mounted chmod your mount point to
   whatever you desire. Make sure to create the initial mount point directory
   within linux (NOT with FTP) so that the group and owner are
   initially set to root.

   chmod 755 /unslung/rc.local  so that the rc.local file is given the
   proper read and execute attributes. Had locked boot up and booting
   without mounting when permissions were 600, as I remember.

   If ORIGINAL storage mount point directory(s) were at  /share/hdd/data/
   now will be linked at   /share/flash/data/share/hdd/data/
   once everything is correctly mounting.
   Then you will see permissions of 700 root root for your mount points at
   /share/flash/data/share/hdd/data/     At least 700 is needed else
   you may get failed boot or no mount.
   /share/hdd/data/  mount point(s) should be 777 or whatever you originally
   set them at.   

   UnPlug? the drive if booting fails reboot and fix everything up correctly then
   plug dive back in and you should not have any problems.
view · edit · print · history · Last edited by SRS.
Based on work by SRS, MicRo, RKrm, Alan, fcarolo, and Alan C.
Originally by Alan C.
Page last modified on February 09, 2010, at 12:43 AM