Martin Michlmayr

A NSLU2 from the front

Tips for running Linux on a flash device

by David Härdeman <>

If you are running your NSLU2 on a USB flash key, there are a number of things you might want to do in order to reduce the wear and tear on the underlying flash device (as it only supports a limited number of writes).

Note: this document currently describes Debian etch (4.0) and needs to be updated to Debian squeeze (6.0) and Debian wheezy (7.0). Some of the hints may still apply, but some may not.

early in the /etc/cron.daily/find script. * syslogd will in the default installation sync a lot of log files to disk directly after logging some new information. You might want to change /etc/syslog.conf so that every filename starts with a - (minus) which means that writes are not synced immediately (which increases the risk that some log messages are lost if your system crashes). For example, a line such as:
kern.*                          /var/log/kern.log
would be changed to:
kern.*                          -/var/log/kern.log
You also might want to disable some classes of messages altogether by logging them to /dev/null instead, see syslog.conf(5) for details. * In addition, syslogd likes to write -- MARK -- lines to log files every 20 minutes to show that syslog is still running. This can be disabled by changing SYSLOGD in /etc/default/syslogd so that it reads
SYSLOGD="-m 0"
After you've made any changes, you need to restart syslogd by running
/etc/init.d/syslogd restart

All of the above kernel parameters can be tuned by using a custom init script, such as this example script. Store it to e.g. /etc/init.d/kernel-params, make it executable with

chmod a+x /etc/init.d/kernel-params

and make sure it is executed by running

update-rc.d kernel-params defaults

Note: Most of these settings reduce the number of writes to disk by increasing memory usage. This increases the risk for out of memory situations (which can trigger the dreaded OOM killer in the kernel). This can even happen when there is free memory available (for example when the kernel needs to allocate more than one contiguous page and there are only fragmented free pages available).

As with any tweaks, you are advised to keep a close eye on the amount of free memory and adapt the tweaks (e.g. by using less aggressive caching and increasing the swappiness) depending on your workload.

This article has been contributed by David Härdeman <>

Go back to the Debian on NSLU2 page.