Moving Temporary Files to Memory (a good idea if you’re using a ssd)

Before starting this process it’s a good idea to backup the fstab file

sudo cp /etc/fstab /etc/fstab.bak

The next step is to edit the fstab file either

nano /etc/fstab


gksudo gedit /etc/fstab

In either case add one or more of the following lines to the bottom of the file:

tmpfs /tmp tmpfs defaults,noatime,size=1G,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

The first line mounts /tmp in memory with a size limit of 1 gig. This may be larger than you need. If you exceed this limit the swap area will be used.

The second line mounts /var/tmp into memory. The third mounts the logfiles in /var/log–note this means that a reboot will clear your log files which may not be what you want. The fourth line mounts the temporary files associated with apt into memory.

The new mount points will become active on your next reboot.

  1. I saw in this address who say to
    “Do not use it on /var/tmp, because that folder is meant for temporary files that are preserved across reboots.” Do you agree?

    • The idea of moving stuff like this into memory made more sense when ssd’s were small and prices were very high. Not so much any more.

      • I would say it’s less about space, since /tmp is small normally, but more about wear and tear on your SSD…

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: