User Tools

Site Tools


howto:tweakmountparameters

Tweaking user partition mount parameters

Introduction

By default, the user partition is mounted with default ext3 options. However, ext3 contains several tunable parameters, and some changes are more suitable for SSD device based storage.

These options include:

  • noatime - I am a bit surprised it is not included as the default. Without this option, kernel will write a timestamp on each file access - this is useful, if you want e.g. to find out seldom used files, but on Asus Eee it is completely useless. Plus, it adds additional wear to the solid state drive. Remember, we want to minimize the number of drive writes, to increase its lifetime. Not speaking about improved reading speed.
  • commit=N - Writes journal to disk each N seconds. Default is 5, but since the Eee is battery backuped, we might allow ourselves longer times. 30 seconds seems a good value.
  • data=writeback - This option improves write throughput. The data will not be written to the disk in an orderly fashion before the journal is commited, but whenever the kernel deems it fit. If the journal has already the new metadata and the computer crashes before the data made it to the disk, the files might contain old portions of data.

Below are descriptions of two methods to change the mount parameters at boot time. Method 1 is easier and has a negligible risk of bricking the Eee.

Method 1: via rc.local

The file /etc/rc.local can contain commands that can be executed at boot-time. To enable it, add a line rc.local to the file /etc/fastservices (create the file if it does not exist). See Starting services for details.

If you removed the unionfs, you can add the following line to /etc/rc.local:

mount -o remount,noatime,commit=30 /dev/sda1

If you are still using unionfs, you would probably need the following command (with sda2 rather than sda1):

mount -o remount,noatime,commit=30 /dev/sda2

(I don't have unionfs anymore to test this. Please update this page if you got it working.) (I don't have the standard unionfs install any more either since I'm using lazyfai's squashfs setup as noted below, however this works fine for squashfs with unionfs so it should be the same for the standard unionfs version).

If you're using lazyfai's squashfs install you should use:

mount -o remount,noatime,commit=30 unionfs

If you are in doubt, you can try mount options from the command line first, prepended with sudo. Type the mount command to see whether the options take effect.

Note: it seems that the kernel or mount version on the Eee does not support changing the data=writeback and commit options while the system is running.

Method 2: Creating a new ramfs

Disclaimer - As usual, you are performing the changes at your own risk! If you do not understand completely what is being done with the changes, do not do it! Read and understand Removing UnionFS/aufs before you start with this howto.

Please see Removing UnionFS/aufs, the process of unpacking and re-packing the initramfs is identical.

  1. Boot the eeePC.
  2. Get a terminal window by typing ctrl-alt-T. In that window execute the following commands:
sudo bash
cd /boot
mkdir tmp
cd tmp
gunzip -c ../initramfs-eeepc.img | cpio -i

Now edit the file init with the editor of your choice.

Find the line that reads:
if ! mount -t ext3 -o rw /dev/sda2 /mnt-user; then

and modify it:
if ! mount -t ext3 -o rw,noatime,commit=30,data=writeback /dev/sda2 /mnt-user; then

You might leave any of these additional options out, or change the commit interval… whatever you think is the best for you.

Repack the ramfs:

  1. find | cpio -H newc -o | gzip -9 > ../initramfs-eeepc-ext3tweak.img

Copy the initramfs-eeepc-ext3tweak.img file to /boot, as per the instructions in Removing UnionFS/aufs, and modify the /boot/grub/menu.lst to use this ramdisk.

Conclusion

The performance improvement is probably negligible - maybe I can see slight improvement in the responsiveness, but maybe it is only wishfull thinking. However, the noatime option and increased commit interval should increase SSD lifetime (even if by a minuscule amount).

howto/tweakmountparameters.txt · Last modified: 2009/03/10 13:45 by albkwan