Slug – Tips

Reducing Memory

Given that it has only 32MB of RAM, NSLU2 runs Asterisk as is very well, but if you want to add more daemons you might need to miser down on the memory.

Dropbear consumes only 2.4MB vs 8.2MB of SSH (who would’ve ever thought I’d be concerned about savings of 6MB of memory!)

Install dropbear:

apt-get install dropbear

Edit the /etc/default/dropbear configuration file:


Remove sshd and start dropbear:

update-rc.d -f ssh remove
/etc/init.d/dropbear start

Here is a comparison of memory usage:

NSLU2:~# ps -eo comm,pid,%mem,vsize | grep dropbear
dropbear 1743 root 1.7 1916
dropbear 1884 root 3.4 2440

NSLU2:~# ps -eo comm,pid,%mem,vsize | grep sshd
sshd 1808 root 3.5 5148
sshd 1904 root 7.6 8216

Asterisk: If you’re running Asterisk, you might want to replace your modules.conf with minimal one found here Slimming Asterisk, it’ll prevent hoards of asterisk modules from loading.

Reducing Disk Writes

If your using a flash drive, you’ll definitely want to reduce the number of disk writes to the drive.

1. Mount with ‘noatime’ parameter, this will stop the kernel from writing the access time every time the file accessed.

/dev/sda1 / ext3 defaults,noatime,errors=remount-ro 0 1

2. Disable syslogd MARK entries
Disable syslogd MARK entries by adding this line to /etc/default/syslogd. You don’t need this if you’re using Debian 5.0.1 (Lenny) – it uses rsyslogd (instead of syslogd) and MARK entries are disabled by default (the “ModLoad immark” is commented out in /etc/rsyslog.conf).

SYSLOGD=”-m 0″

3. Log files are sync’d immediately to the filesystem the moment they are written to. To prevent immediate sync’ing, dash out all entries in /etc/default/syslogd. It will still write to the log files, just that they won’t get sync’d immediately.

4. Move samba caching to a ramfs
On doing a “find /var -mmin -10 -ls” I found some files that were being written to regularly by samba. Moved this to a small ramfs, by adding this line in /etc/fstab:

none    /var/cache/samba    ramfs    maxsize=512    0    2

5. Set swappiness value to zero (default is 60):

echo 0 > /proc/sys/vm/swappiness

or set this in /etc/sysctl.conf:

vm.swappiness = 0

6. Tune disk writes. Set the following in /etc/sysctl.conf:

vm.dirty_background_ratio = 5              # default = 5
vm.dirty_ratio = 50                                # default = 10
vm.dirty_writeback_centisecs = 500        # default = 500
vm.dirty_expire_centisecs = 3000           # default =3000

Spinning Down the Drive

After trying a couple of different ways to do this (hdparm, scsi-stop, etc), I found I had the best luck with the sg_start utility (from sg3_utils package):

Get the packages:

sudo apt-get install sg3-utils libsgutils1

Example command to spin down:

sg_start –stop –pc=2 /dev/sdb

Very useful. Besides using it for the slug, I also use it to force spin down my external drive after unmounting it and just before I pull the USB cable – so that I don’t get that horrible “clunk” noise in the drive.


Some other things you might want to put into your Linux on Slug:

1. Enforce file system check
Given that the NSLU2 is headless, you definitely don’t want to be left helpless, should it ever go into maintenance mode asking you to do fsck. So enforce fsck, add the following in /etc/default/rcS:


2. Power Button
The default setup causes the power button to reboot. I changed it to shutdown:

ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -h now


De-Underclocked Slug

Following the instructions at Overclocking the Slug, I decided to overclock my NSLU2 today, and pulled out my soldering iron.
It seems you’re not really overclocking it… but restoring it to its normal/full speed of 266MHz. For some reason these units shipped configured to run at 133MHz, done via a pull down resistor (R83) – which one simply has to de-solder.

In doing this I didn’t realize just how tiny they’d be (the last time I soldered something was more than 15yrs ago). Less than 1mm away from the adjacent resistor. Next time, I’ll just snip it off with a pair of nail-clippers like some sluggers have done.

In that end… I have a 266MHz server, 32MB RAM, with Debian on a 2GB flash (with Asterisk, ssh, lighttpd, ruby,… with still 1GB free space left!). Costing only $70 and only 10w of power – can be kept on 24×7 with no sweat (contrast that with at least 200w Intel/AMD based server costing at least $400).

One thing I got out of this exercise… is that I found out that I needed reading glasses 8-|.

My Slug :-)

Got my NSLU2 today. It’s small, less than 5w, no moving parts, no fan. Specs: 266MHz ARM processor (XScale IXP420 ARMv5TE), 32MB SDRAM, 8MB Flash, 2GB USB Flash.

First thing I did was to replace the Linksys firmware with Linux. The possibilities for use of this thing are endless: as a print server, file server, internet radio, file downloads, etc. At 5w you don’t have to worry about wasting energy (compared with a 70w laptop or a 300w desktop), and can run it 24×7 without fear of damaging it.

I installed Debian/NSLU2 – Debian/ARM running on NSLU2.

The instructions for installing Debian/NSLU2 were pretty straight forward and worked with no problem.

FYI, pullout locations: for JTAG, GPIO, USB ports.

RedBoot Bootloader

Here’s some tips I got about accessing the firmware’s Redboot bootloader. That is, before you do anything you might want to make sure you can get to RedBoot bootloader’s command prompt on the NSLU2. By default RedBoot listens on, so you’ll need to add a route to that first.

First turn off the NSLU2 and execute this in a terminal:

sudo route add eth0
sudo arping -f; telnet 9000

Then turn on the NSLU2. The above telnet will wait…

[spari@localhost ~]$ sudo arping -f; telnet 9000
ARPING from eth0

The moment it connects and returns the RedBoot prompt, hit Control-C (you will have less than 2 seconds to do that!):

[spari@localhost ~]$ arping -f; telnet 9000
ARPING from eth0
Unicast reply from [00:31:41:59:26:54] 5.134ms
Sent 12 probes (12 broadcast(s))
Received 1 response(s)
Connected to (
Escape character is ‘^]’.
== Executing boot script in 1.430 seconds – enter ^C to abort

The Slug

If I’m going to be running an Asterisk server 24×7, I shouldn’t really be needing a full blown PC or even a barebones PC costing at least $400 and burning at least 300-400W of power. I needed something which would consume less than 100W of power and cost less than $100.

My runner ups were the AMD Geode or the VIA C7 based boards. Both consume only about 40W of power (processor alone about 15-20W), and cost around $300. But after hours of reading up on Geode or C7 based boards – none of them satisfied me – each board had one peculiar problem or the other.

Then… I came across the Slug. In the same line as people hacked XBox’s to run Linux, a group of great folks have hacked the Linksys NSLU2 NAS to run Linux. At $70, consuming less than 10W, and solid state, the possibilities are endless: Asterisk, Internet Radio, File Sharing, Printer sharing, 24×7 web server, SSH, etc.

The heart of the Slug is an XScale IXP420 ARMv5TE processor, 133MHz, 32MB SDRAM, 8MB Flash, Linux firmware, Redboot bootloader.

More about the slug on the Slug Group.