Search code examples
linuxsymlinktmp

Is it safe to temporarily rename /tmp and then create a tmp symlink to a different location?


The situation is that this application needs more space in /tmp. Currently my tmp folder is in root's partition. Is it safe to temporarily create a tmp symlink to a different partition just to take advantage of the larger space?


Solution

  • Instead of renaming and/or symlinking, you can:

    mount --bind /path/to/dir/with/plenty/of/space /tmp
    

    And umount /tmp when you are done.

    If you are on a mission critical server, you can check if any program is currently using /tmp with lsof /tmp before doing the above.

    NB: Run all commands as root.