/tmp on disk vs. tmpfs

I installed Lubuntu 19.10 yesterday, which went very smoothly: up and running very quickly. :+1: One thing I noticed was that the install didn’t give me an option to create a partition for /tmp, but that it automagically configured it to use tmpfs instead. I can understand the performance benefits of one approach vs. the persistence of the other. Any other considerations here? Am I overthinking things? :thinking:

2 Likes

From what I’ve read, /tmp offers no expectation of persistence. (/var/tmp does?). From what I understand, tmpfs makes /tmp more seamless. But, if your machine has low memory, you might be better off creating a manual partition mounted at /tmp. But, the downside of doing that is that you might need more space for some rare, /tmp intensive operation. Then you have to spend an hour or two resizing partitions to make /tmp larger. But, on a low-memory machine you might want to be aware of such demands for temp space (more in control of it).

In the 3rd or 4th install screen there is an option to choose “something else” or “manual partitioning” (I forget what it’s called). I don’t recall looking for the /tmp mountpoint. But, there’s a large list of mount points there. I assume it would be available in that list. The only downside to using that screen is that you have to assign everything needed (/, /home if you want it in its own partition, /boot/efi if it’s an UEFI system, a swap partition). I feel like I know what I’m doing, but I struggle with that stuff. All I ever do is mount /home on its own partition for easier reinstalls preserving my files.

Tmpfs is probably a good tradeoff in terms of what works for most people. If someone’s memory constrained and would prefer a /tmp on a real partition, they probably have a less resourceful hard disk too. Someone would complain too much space was dedicated to /tmp (someone else would complain that it’s too small). Most people wouldn’t want to be bothered with that anyway. One solution would be to use LVM to manage the available disk space. But, that’s probably more than most people would appreciate being forced into as a default environment.

If you have low memory but a large hard disk, I would consider putting /tmp on a generous partition. It would be interesting to see a /tmp-hungry process benchmarked that way versus tmpfs extending into swap. I have a script I found that purports to do Crystalmark-like benchmarks for hard drives, enclosures, etc. That could probably be used to compare /tmp vs tmpfs. I’ve been testing 20.04 images lately. That might be fun to try. I could remove memory from a laptop to make it 2g.

Thanks for the reply.

Yes, I did the manual partitioning with the intention of allocating my own /tmp partition (very old habits die hard!). But /tmp wasn’t offered as a mount point, so I was going to manually sort that out post-install. But in the end I saw the tmpfs arrangement, which is fine so far, since I’ve got plenty of memory. (Hopefully that rare need for bags of /tmp space will never happen. I can’t think of why it might…)

So now I just have an extra partition going begging! I’ll sit tight and see how it goes. I can always use the spare partition if I ever feel the need.

SSD perhaps? Upstream code seems to suggest it will necessarily do tmpfs.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.