Archive for May 2nd 2012

I just received my 666th spam comment on this blog. I hope that doesn’t bode ill for the site.

I saw a post on a web forum recently asking about optimising Linux to run on an SSD. One problem with SSDs is that they don’t like being written to repeatedly, so I’ve worked around that by pushing most commonly updated files into /tmp, which is mounted as a RAM drive. I have an rc.local script which creates a file tree in /tmp for each user and then I created links in the user’s home directory which point to the relevant directory in /tmp.

In /etc/fstab:

tmpfs /tmp tmpfs defaults,noatime,nodev 0 0

Unfortunately Ubuntu seems unable to run with noexec turned on in /tmp.

In rc.local:

# Create user directories in /tmp
DIRNAME=files
cd /home
for i in *
do
grep "/home/$i" /etc/passwd > /dev/null
if [ "$?" -eq "0" ]
then
if [ ! -d /tmp/$DIRNAME/$i ]
then
mkdir -p /tmp/$DIRNAME/$i/mozilla-cache
mkdir -p /tmp/$DIRNAME/$i/thunderbird-cache
mkdir -p /tmp/$DIRNAME/$i/cache
mkdir -p /tmp/$DIRNAME/$i/thumbnails
mkdir -p /tmp/$DIRNAME/$i/adobe
mkdir -p /tmp/$DIRNAME/$i/macromedia
chmod -R go= /tmp/$DIRNAME/$i
chown -R $i:$i /tmp/$DIRNAME/$i
fi
fi
chmod a+rx /tmp/$DIRNAME
done