ZFS Correctly move /tmp from zpool to UFS on SSD

Currently I have the following:

# mount
Code:
space/ROOT/default on / (zfs, local, noatime, nfsv4acls)
devfs on /dev (devfs, local, multilabel)
/dev/da0p1 on /ssd (ufs, local, noatime, noexec, soft-updates)
space on /space (zfs, local, noatime, nfsv4acls)
space/tmp on /tmp (zfs, local, noatime, nosuid, nfsv4acls)
space/usr/home on /usr/home (zfs, local, noatime, nfsv4acls)
space/usr/ports on /usr/ports (zfs, local, noatime, nosuid, nfsv4acls)
space/usr/src on /usr/src (zfs, local, noatime, nfsv4acls)
space/var/audit on /var/audit (zfs, local, noatime, noexec, nosuid, nfsv4acls)
space/var/crash on /var/crash (zfs, local, noatime, noexec, nosuid, nfsv4acls)
space/var/log on /var/log (zfs, local, noatime, noexec, nosuid, nfsv4acls)
space/var/mail on /var/mail (zfs, local, nfsv4acls)
space/var/tmp on /var/tmp (zfs, local, noatime, nosuid, nfsv4acls)

# cat /etc/fstab
Code:
# Device                Mountpoint      FStype  Options                         Dump    Pass#
/dev/da0p1              /ssd            ufs     rw,noexec,noatime               0       0
md99                    none            swap    sw,file=/ssd/swapfile,late      0       0
What would be the correct way to move /tmp from the pool? I guess just symlinking /tmp to /ssd won't work.
 
Last edited by a moderator:
How about creating another partition on the ssd (let's say /dev/da0p2) and mount that one onto the moint point /tmp instead of space/tmp?
 
If you have no free space on the SSD you could try a nullfs mount.

Create a /ssd/tmp directory and then:
Code:
/ssd/tmp      /tmp       nullfs     rw      0       0

You might need nullfs_load="YES" in /boot/loader.conf.

You could also do exactly the same as you're doing for swap - That seems to be using a memory disk, backed by the file /ssd/swapfile. Create a file of a reasonable size ( truncate -s 500M /ssd/tmpfile) then add to fstab, same as swap)
 
How about creating another partition on the ssd (let's say /dev/da0p2) and mount that one onto the moint point /tmp instead of space/tmp?

Just add water record to /etc/fstab and it will move automatically after the reboot?

If you have no free space on the SSD you could try a nullfs mount.
...
You could also do exactly the same as you're doing for swap - That seems to be using a memory disk, backed by the file /ssd/swapfile. Create a file of a reasonable size ( truncate -s 500M /ssd/tmpfile) then add to fstab, same as swap)

I have plenty of space, just want to move /tmp out of HDD raidZ to the fast SSD.
 
How about creating another partition on the ssd (let's say /dev/da0p2) and mount that one onto the moint point /tmp instead of space/tmp?
Just add water record to /etc/fstab and it will move automatically after the reboot?

Yes, like so:
Code:
# Device        Mountpoint      FStype  Options                 Dump    Pass#
/dev/da0p1      /ssd            ufs     rw,noexec,noatime       0       0
/dev/da0p2      /tmp            ufs     rw,noatime              0       1
...
...
 
tmpfs(5) is faster than a UFS filesystem.
May be. However, does this really count, given that read/writes are usually cached, and given that /tmp on a server usually holds only small amounts of data. How many nanoseconds can we expect to save per hour with tmpfs compared to ufs2?
 
May be. However, does this really count, given that read/writes are usually cached, and given that /tmp on a server usually holds only small amounts of data. How many nanoseconds can we expect to save per hour with tmpfs compared to ufs2?

There isn't really a point in giving /tmp an entire disk. Just give it a gigabyte or two of RAM.
 
For some applications, avoiding the round-trip overhead of a filesystem could be a real advantage. But it's nice to have an auto-clearing /tmp too.
 
Back
Top