Re: Swap file on USB

General Schvantzkopf (schvantzkopf@xxxxxxxxx) writes:
On Fri, 09 Nov 2007 14:55:54 +0000, Theo Markettos wrote:

I have a Netgear wireless router (a WGT634U) on which I've installed
Debian. It has 32MB SDRAM built in, in a way which isn't upgradable
(well, some serious soldering would be required). I'm running some apps
on it which are using up most of the RAM, and I want to run some more
which will be idle much of the time (specifically I want a webserver and
SQL database).

The only interface the router has is a USB port. Currently I have the
root ext2 partition mounted with -o noatime on a 2GB Kingston flash
stick, which seems to get reasonable performance (about 17MB/s read,
8MB/s write I think). I've given it a 128MB swap partition on the
flash, but I don't think this gets used too much.

But I'm probably going to be swapping a lot more with the extra apps.
Any suggestions of the best way to run a swap file on USB? I don't want
a hard drive - I want a low power router. I can think of:

1) Just use the flash as swap until it wears out, then replace it. Will
wearout trash the other data on it, or will it just start returning disc
errors and/or garbage for the swap sectors and leave the rest unchanged?

2) Get another flash stick for swap. Easier to replace but means I need
a USB hub (the router doesn't have a huge amount of power to spare so
it'd probably be a powered one)

3) Does anyone do RAM on USB?

4) Use an IBM microdrive in a CF-USB adaptor. Would probably need it in
addition to the existing flash stick

5) Some kind of swapfile driver that tries to optimise writes to the

6) Wear leveling over both partitions so that just the swap part uses
writes from the root partition

Any thoughts?


Why are you trying to run a server on a router? Don't you have an old PC
laying around that you could use? Anything would be better than a router
with only 32M of RAM in it.

Surely one reason is that a whole computer takes up space, but a router
is relatively small.

I imagine the novelty is part of it all. I have seen articles about
using such routers as dedicated Linux controllers, because they are
relatively inexpensive, and commonly available. They are being treated
as a new wave of single board controllers, much in the same way that
circa 1982 there was an article in Kilobaud about using a single board
computer that had an ascii keyboard built in because it was cheaper
to buy those than do development on a dedicated computer and build
them in a pretty limited number.