Thursday, January 8, 2009

Fine tuning for your slug


Flash disks have limited writing lifetimes so we better use it wise. There are some precautions that you should consider if you are using a flash disk as a root drive for NSLU2. In order to reduce the writings to the flash disk you can find something useful below. Also there are some other "recommended" tweaks for your slug.

1) Syslogd writes -- MARK -- lines to log files every 20 minutes to show that syslog is still running. Disable this by changing SYSLOGD in /etc/default/rsyslog so that it reads
SYSLOGD="-m 0"

After the change, restart syslogd by running
/etc/init.d/rsyslog restart


2) Create.ext3flash file in the root. Write
touch /.ext3flash


3) If you do not have a serial port in your slug you can disable getty by commenting the corresponding line in /etc/inittab as shown below. Change
T0:23:respawn:/sbin/getty -L ttyS0 115200 linux

to
#T0:23:respawn:/sbin/getty -L ttyS0 115200 linux

to re-read the inittab file.
telinit q


4)If you have a swap partition on flash, it might be a good idea to minimize swapping. View the current swapping behavior by typing
cat /proc/sys/vm/swappiness

if you see 60 or something else you may want to change it to zero.
echo "0" > /proc/sys/vm/swappiness


5) Unless you have a serial console, it's a good idea to edit /etc/default/rcS and set FSCKFIX=yes, to prevent fsck problems from hanging your boot waiting for you to press "y" on a nonexistant console. To edit write
nano /etc/default/rcS


6) If you want to see the boot logs edit /etc/default/bootlogd and change
BOOTLOGD_ENABLE=No

to
BOOTLOGD_ENABLE=Yes


You can see boot logs in /var/log/boot.

7) Add 'noatime' option to /etc/fstab, to prevent updating the file-access-timestamp each time a file is read (atime='access-timestamp'), thus preventing a lot of write actions to the flash disk. To edit ftab type:

nano /etc/fstab

Here is my adjusted ftab file



By the way I am not the author of these adjustments. I just thought it would be good to find all these in one place. If you know something useful I did not mention, let me know so I will add to the list. Cheers :)

1 comment:

  1. The swappiness setting doesn't stick when rebooting
    edit sysctl.conf:
    nano /etc/sysctl.conf

    add:

    vm.swappiness=0

    to the bottom

    reboot & check with:
    cat /proc/sys/vm/swappiness

    ReplyDelete