I have two harddrives on my computer running Linux Mint. The first is an SSD and has my / partition and the second is an HDD and has my /home partition.

I have heard that too many writes to the SSD is bad, so I have attempted to move the location of the /tmp folder to somewhere on the HDD. To do this I created a folder on that drive, gave owner to root, set permissions via chmod to 1777, then ran

ln -s /tmp /new/location/tmp

Applications seem to be using the new /tmp folder, but the folder does not seem to be emptying itself on reboot. I have edited /etc/default/rcS to set TMPTIME=0, but this does not seem to fix the issue.

How do I fix this problem?

  • 2
    I never tried doing this with /tmp, but I did this with /var/{tmp,log,cache}. Can you try using bind mounts instead? i.e. edit /etc/fstab, add /HDD/tmp /tmp none bind 0 0, remove the original /tmp symlink, recreate the directory, then reboot. – Sparhawk Aug 30 '15 at 3:46
  • Some distros default to /tmp on tmpfs, so it's not backed by disk at all (other than swap space). I'd suggest that if you don't want /tmp churn on your SSD. – Peter Cordes Aug 30 '15 at 5:00
  • @PeterCordes Yes, good point. I had a search to see what it was in Mint, but I found some clear instructions for /tmp here. – Sparhawk Aug 30 '15 at 5:16
  • There is no use in putting /tmp onto a harddisk, unless you are running some very specific applications. Otherwise, the amount of writes is really negligible, and you will almost certainly change your SSD due to its insufficient size earlier than it will approach even 50% of its write cycles. – Paweł Rumian Aug 31 '15 at 13:01

ln -s /tmp /new/location/tmp

The command is backwards. The parameter order for ln is the same as for mv or cp: source, then destination.

You might want to consider resizing your /home partition to make space for a new /tmp partition, since it needs to be available very early in the boot process, possibly before /home comes up.

Alternately, you can mount /tmp as a ramdisk, if your system isn't tight on RAM.

| improve this answer | |
  • How much RAM should I have to mount /tmp as a ramdisk? Even if I have enough is that preferable? Thanks – user45150 Aug 30 '15 at 16:44
  • @user45150: Re: How much RAM, obviously you need to be able to dedicate as much free RAM as your system ever needs for /tmp space. There is no way I can tell you how much that is. It's like asking how much space you need for MP3s. – Warren Young Aug 31 '15 at 3:03
  • @user45150: Re: Whether it's preferable, I'd argue "no," because your OS's page cache keeps much of /tmp in RAM already. /tmp on a RAM disk was more common before buffer caching systems became as sophisticated as they are today. I offered the idea only because it would be a way to move /tmp off the SSD without making space for a dedicated partition on the HDD. It's not a bad solution, just not as efficient as making use of the OS's page cache, since the OS knows better than you do what it needs at any given instant. – Warren Young Aug 31 '15 at 3:06

Its better to create a new partition for /tmp on the new hard disk.

And then add it to /etc/fstab

UUID="uuid-of-new-partition" /tmp ext4 Defaults 0 0
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.