I have a Ubuntu 14.04 server which has one drive where rootfs is mounted.
I just added an SSD disk which I have mounted at /ssd
Now I want my /tmp & /var/tmp to use this fast drive to speed up my server. First I wish to tackle just /tmp (and I know repeated writes may shorten the life of ssd).
In my crontab, I wish to add an entry like this:
@reboot /bin/sleep 5; install -d -m 1777 /ssd/tmp
&& install -d -m 1777 /tmp && rm -r /tmp && ln -s /ssd/tmp1 /tmp
the potentially superfluous install -d -m 1777 /tmpis only there to make sure that rm -r /tmp does not fail (and rm -r /tmp exists to ensure that ln -s does not open another tmp under /tmp which will make this set ineffective.