Soma's Blog

December 4, 2009

Unslung Adventures

Filed under: Linux,Tech — somanov @ 23:16

I recently bought a Linksys NSLU2 Network Storage Link from Amazon :

The Linksys NSLU2

Basically this little guy connects two normal USB drives to your network exposing them as samba shares…or at least thats the purpose the manufacturer intended for it. But with the right firmware it can do a lot more..

After playing around with the stock firmware for a while I decided to try one of the replacement firmwares from http://www.nslu2-linux.org/ . There are several projects which offer custom (Linux-based) firmwares for users with different Linux expertise. There is a Firmware Matrix which shows what the different versions can do.

I mainly wanted to expose my USB drives to my home network (and maybe have a neat toy to play around), so I decided to go with the Unslung 6.10-beta firmware, which is basically an improved and open version of the stock firmware. It offers a nice web interface, has a lot of custom built packages and is targetted at users with little Linux knowledge.

All in all flashing the new firmware and configuring the device went pretty well. I followed the steps in the excellent Readme. However I ran into a few gotchas while configuring the device, some of which I did not find too clearly documented in the wiki. I thought it might help to post my findings. So here they are (in no particular order):

Stay away from NTFS
Actually this one is clearly stated in the FAQ but I thought it might be a good idea to emphasize it. Unslung -like the stock firmware- is based on a 2.4 Linux Kernel. It uses a very old and buggy NTFS driver, which did not play very well with my 1TB NTFS drive. Directories with a lot of files in them were empty or would not be displayed at all. Also it appears the driver may cause the whole system to hang under high IO load. Other firmwares like OpenSlug are based on a more recent 2.6 Kernel, and _might_ not have these problems (I guess the ntfs-3g module should be available there, but I did not check). Anyaway I decided to stay with Unslung and to reformat my drive to ext3. Which brings me to my next point:

Be careful with EXT3
In principle Unslung supports the ext3 filesystem, but it is very picky about its parameters. In particular it is unable to handle ext3 filesystems with an Inode size of 256 (this setting is standard when creating the filesystem from a modern Linux distribution). I had to use the following command to create an ext3 filesystem that would work in Unslung:

mkfs.ext2 -j -I 128 -m 1 /dev/sdb1

If you have an existing ext3 disk and want to know if the Inode size is compatible use:

sudo tune2fs -l /dev/sdb1 | grep Inode

An other related point:

The WebGUI’s “format” option does not create a simple ext3 filesystem
(although it might appear to be the case). If you format a drive in the web-gui you get a natively formatted disk. It has an ext3 partition for your data but contains additional partitions which are used by Unslung to store config files etc. This distinction is very important as you might be running into a lot of trouble with two natively formatted devices (see Rule 1 + the exceptions to Rule 1 ). In order to make the most of your device you need one natively formatted device (which contains the “unslung” root filesystem), but it is safer if you do not have two. But its no problem to have your other disk formatted as ext3, as long as you did not format it in the web-gui. Do it on a normal linux-box and use the command I mentioned above.

Your ext3 drive will not auto-mount
I dont know if thats a general rule, or just my stupidity, but I could not get the ext3 drive to auto-mount. The device would be recognized but I could not get Unslung to automatically mount it and create a samba share for it. The details of manually achieving this are worth mentioning because they were quite surprsing for me:

  • Dont use /etc/fstab ! It is overwritten at boot (dont know why). Also it does not understand the “auto” option which would be needed to automatically mount the device anyway. Instead I added the required mount command to /etc/rc.d/rc.local For a somewhat cleaner solution have a look at diversion scripts
  • Manually add the samba share to /etc/samba/user_smb.conf . My entry looks like this:
    [NAS]
    valid users=@"administrators",@"everyone"
    comment=For everyone
    path=/mnt/usb_maxtor/nas/
    read only=no
    write list=@"administrators",@"everyone"
    

Transmission
Transmission is a Bittorrent client which can be installed with the “ipkg install” command. It provides a nice web interface for managing your torrents and works pretty well. When I first started the transmission-daemon and tried to connect to the web interface, I got an error message telling me that access from my IP was not allowed and that I should add it to some config file to fix this….but alas I could not find the file -it had not been created. The fix for this was to run

transmission-daemon -a <my_ip>   # adds  my_ip to the list of allowed addresses

this allowed me to access the web interface, and also created the config file that was missing before.

Ok thats all I can think of for now. Maybe I’ll post an update to this if I find any more things worth mentioning 🙂

Advertisement

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: