0

I have an SSD (256gb) with two partitions, one of the with Ubuntu. I also have an HDD with /home and a partition for data (music, videos, etc). I would like to move /tmp (on the ssd) to /home (on the hdd). So far I have only found one answer saying that the way to do this is:

mv /tmp ~/tmp
ln -s ~/tmp /tmp

Would this actually work? Shouldn't I also change something in /etc/fstab? Thanks

4
  • Do you want to move the content of /tmp to /home or do you want to create a new partition on you HDD for /tmp. Many set ups have their /tmp directory entirely in main memory on a tmpfs file system by the way, since there's nothing in there that needs to survive a reboot. Oct 6, 2014 at 13:58
  • The issue started when I wanted to open a file in audacity and I didn't have enough space on /root. I only have 10gbs available there. But I guess a better solution would be to move /tmp to RAM (I have 24gb of RAM).
    – aripod
    Oct 7, 2014 at 6:47
  • I've just moved /tmp to RAM but /var/tmp keeps filling up. For what I read, /var/tmp should not be moved to ram. So I guess I should move it to /home (btw, I already have a partition for home at the hdd and that's where I would like to move /var/tmp
    – aripod
    Oct 7, 2014 at 7:02
  • Good to know. I had /var/tmp symlinked to /tmp (luckily without problems so far). In my setup /var and /home are entirely on HDD, while the rest of / is on SDD. Oct 7, 2014 at 10:23

1 Answer 1

0

It would, but you would also need to do some more things. The default permissions of /tmp are this:

# stat /tmp
...
Access: (1777/drwxrwxrwt)  Uid: (    0/    root)   Gid: (    0/    root)

Since the permissions of the link are the permissions of the target, you will have to change the permissions of ~/tmp. At the least, it should be world-readable and -writable:

chmod a+rwx ~/tmp

The t bit should also be set (see What is the "t" letter in the output of "ls -ld /tmp"?):

chmod +t ~/tmp

There might be other problems. If any directory in the path for ~/tmp doesn't have execute bit set for others, this folder will be inaccessible for most users.

I missed the obvious flaw in this:

Any attempt to use /tmp before your home directory is available will fail.

This might be one place where bind mounts are better than links.

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.