How to: Reduce Disk Writes to Prolong the Life of your Flash Drive
From EasyPeasy Wiki
Please note: This customization is not included in Ubuntu Eee 8.04 by default.
Contents |
[edit] Move /tmp, /var/tmp, /var/log and /var/log/apt into RAM
[Note: This is not needed on EasyPeasy, only for stock Ubuntu]
Using the fstab file we can move temporary data and log files into RAM. This process mounts each location as a temporary file system.
sudo gedit /etc/fstab
Add the following lines to the bottom of your fstab file.
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0 tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0 tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0 tmpfs /var/log/apt tmpfs defaults,noatime 0 0
Wicd 1.5 users: Do not add the last 2 lines otherwise the Wicd daemon will fail to start. This is a known Wicd bug.
To determine which version of Wicd (if any) you have, type the following command:
dpkg -s wicd
Note: Your log files will vanish after each reboot. But other than that, there are no harmful side effects from this operation.
You might add also unionfs for /var/cache at the end of fstab:
none /var/cache unionfs dirs=/tmp:/var/cache=ro 0 0
[edit] Tweak Primary File Systems
The following options can be added to your remaining partitions to help lower disk writes:
- Use the "noatime,nodiratime" options for any of your reiserfs partitions in /etc/fstab. This also gives slightly faster filesystem performance.
- Use the noatime option for any of your ext3 partitions in /etc/fstab. See Geek Sheet's blog for more details.
- Use the non-journalling filesystem ext2 at the cost of data reliability.
[edit] blkid.tab and mtab
The following commands can be executed to further reduce disk writes. If you wish to mount anything through fuse the second set of instructions will likely cause problems, if you go ahead and later need to mount something, instructions for removal of this link can be found on the talk page for this article.
sudo rm -f /etc/blkid.tab* sudo ln -s /dev/null /etc/blkid.tab
sudo rm -f /etc/mtab sudo ln -s /proc/mounts /etc/mtab
See Debian Administration for more details.
[edit] Optimize Firefox Cache
Note: Each user will have to perform this operation when logged in for it to affect them.
Launch Firefox and enter about:config into the URL bar and press enter. Right click and select New > String; enter browser.cache.disk.parent_directory as the name and /tmp as the string value. This will instead store the cache in RAM (if you followed the first operation in this article.)
Alternatively you can set the cache to 0Mb on the Network tab of the Advanced section in the Firefox preferences. This may cause slow performance on EEEs with less than 512Mb of RAM.
I also found browser.cache.disk.enable key. It might be enough to set it to false.
[edit] Optimize Apt Archives
- sudo
chmod u+x /etc/rc.local - add following line into
/etc/fstab
tmpfs /var/cache/apt/archives/ tmpfs defaults,noatime 0 0 - add following line into
/etc/rc.local
mkdir /var/cache/apt/archives/partial
All deb package will be downloaded into ramfs, and keep in mind not to make to much upgrade at one time to save ram space, usually 512MB should be enough for most install and upgrade.

