Martin Michlmayr
A NSLU2 from the front

Tips for running Linux on a flash device

by David Härdeman <david@hardeman.nu>

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.

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 <david@hardeman.nu>

Go back to the Debian on NSLU2 page.