Move Linux tmp folders

I have Mint 19 installed on a fairly old machine, where the performance isnt great. I was able to move the swap partition to a ZFS pool with these instructions. However, I want to move the /tmp and /var/temp to the ZFS pool for increased disk speed, as well. However, I cant seem to find decent instructions on how to do that. How should I go about moving those two folders into a ZFS pool?

1

1 Answer

Replace rpool with your ZFS pool name in the instructions below.

Move /tmp to ZFS

  1. Move your existing /tmp directory somewhere else:

    mv /tmp /tmp2
  2. Create a ZFS file system for /tmp. Note that the mountpoint property should be legacy due to an outstanding race condition bug mentioned in the ZFS on Linux wiki [Archive, step 4.11].

    zfs create -o mountpoint=legacy rpool/tmp
  3. Copy the contents of your old /tmp folder to the new one:

    rsync -avHXShPs /tmp2/ /tmp/
  4. Verify that the contents copied over correctly before deleting the old /tmp folder:

    rm -rfv /tmp2
  5. Add the new /tmp folder to /etc/fstab so that it is mounted on boot:

    echo "rpool/tmp /tmp zfs defaults 0 0" | tee -a /etc/fstab

Move /var/tmp to ZFS

Basically the same instructions apply.

  1. mv /var/tmp /var/tmp2
  2. zfs create -o mountpoint=none rpool/var
    zfs create -o mountpoint=legacy rpool/var/tmp
  3. rsync -avHXShPs /var/tmp2/ /var/tmp/
  4. rm -rfv /var/tmp2
  5. echo "rpool/var/tmp /var/tmp zfs defaults 0 0" | tee -a /etc/fstab

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like