Limit noise from hard disk using RAM (tmpfs) instead

I’m using a laptop, among other things, as alarm clock (included in my -utils general debian package). The hard disk of this laptop is not getting any younger and get noisy while there’s a decent amount of RAM available.

I toyed a bit in the past with ramdisk/tmpfs (the later having the benefit not to used a real fixed size but to adjust and unused memory free) and made tests to use tmpfs for /var/log. Since then, I did not use much this so-called transient log: it cannot be seriously used on a server where you want your logs not tampered with in any way – and especially there in case of failure; it does not make laptop or workstation very silent since there is still a large amount of file access that is in ~/.

In the case of my laptop part alarm clock, many ~/.directories and ~/.files are regularly read or wrote. So I finally changed the initial transient log init script into /etc/init.d/shush-toram that reads /etc/default/shush-toram to determines which directories to put into tmpfs, for instance /var/log and /home/alarmclockuser. bviously, you don’t want to put on tmpfs in directory that would use all or more of your actual RAM. There is also a /etc/cron.daily/shush-toram job that’ll daily update the data on the hard disk (just calling the init script with reload or restart).

Once the scripts in place, you just have to do:

invoke-rc.d shush-toram start      # start it
update-rc.d shush-toram defaults   # set autostart

Yeah, that’s sysv init scripts. It’s probably not necessary that I discuss the merits of systemd. I tried it and was happy to boot faster than usual. Then I found that making init scripts with it was annoying, counterproductive for me. Then I found that my /var/log directory contained a subdirectory journal of more than 800 Mo – that can be fixed by editing some conffile obviously, but it’s not working clean out of the box. It just does not suits me. It could, and will surely, improve. Still, it’s being made mandatory here and there while it’s still counterproductive and unpolished. I’ll continue to make script for sysv -that can actually be started outside of sysv- since I’m likely to try to avoid systemd as much as possible.

The shush-toram files are included in my -utils general debian package.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s