Special Handling of a Flash Drive for the Unslung Root Drive
Using a flash drive is often an attractive way to run an Unslung NSLU2. It's quiet, small, low-power, and low-cost.
However, they do have a significant disadvantage compared to the traditional hard-drive -- they wear out much, much faster.
A couple of simple changes to how Unslung uses the flash drive can greatly extend the life of the flash device:
All that is required to instruct Unslung to make the necessary changes is to create a file named
Once created, the changes will take effect at the next boot.
Nothing is ever free - and these changes also carry a potential cost. Certain applications may use the "last-accessed" timestamp, and these may misbehave when the accessed-time stamp is disabled (e.g. dropbear started via inetd). Swap space is used when the operating system runs low on main memory. And since the NSLU2 has only a small amount of RAM to begin with, large applications or many applications at the same time may run the system out of memory.
During the boot process, if the
Note: Unslung 5.5 only supports a flash disk as the root drive on USB Port 1. Unslung 6.x supports the use of a flash disk as the root drive on either USB port, although USB Port 2 is often preferred.
Reducing the number of writing even more
I've applied the spindown script, which copy all files from /dev and /var into a Ram-filesystem,taken from: http://www.nslu2-linux.org/wiki/FAQ/SpinDownUSBHarddisks. It is a bit dangerous, as the RAM-fs eats up more of the tot available 32Mb, while Ext3flash already has disabled swap.... After a year of using this script, I haven't had problems with this configuration. I can happily use the firefly mediaserver, nfs and the transmission torrent-client, and have no crashes.
#!/bin/sh # /etc/init.d/mount_var_dev.sh # Script section to create ramdisk for /var and for /dev # disable the oom-killer to use the full swap /sbin/sysctl -w vm.overcommit_memory=1 # From JNC : this command does not exist on my slug (release 2.7) # better only use /var/log then the full /var # following lines might need to be adjusted according to your OS and/or installed services /bin/echo "Creating ramfs for /var/log:" /bin/mount -t ramfs ramfs /mnt -o maxsize=256 /bin/cp -rp /var/log/* /mnt/ /bin/mount -o bind /var/log /var/log.state /bin/mount -o bind /mnt /var/log /bin/umount /mnt /bin/echo "Creating ramfs for /dev:" /bin/mount -t ramfs ramfs /mnt -o maxsize=256 cd /dev find . -print0 -mount | cpio -p -0 -d -m -u /mnt # you can not use cp command for /dev /bin/mount -o bind /dev /dev.state /bin/mount -o bind /mnt /dev /bin/umount /mnt # Uncomment the following line when using debianslug #mount devpts /dev/pts -t devpts # Return and continue execution of system rc. return 1 # [EOF]
The result on my Unslung6.8 slug with Ext3flash also applied:
bash-3.2# free total used free shared buffers Mem: 30524 28788 1736 0 4900 Swap: 0 0 0
I've got the firefly mediaserver and bash running alongside the original Linksys app and appr. 5% of 32Mb left...., so it seems. However, the 4900 Kb allocated to the buffers is available for programs directly. Linux is just using this for buffering data for the disks. The 1736 kB which is free, is in effect wasted; it's not used for any purpose.