[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Idea: mount /tmp to tmpfs depending on free space and RAM

On Tue, Jun 12, 2012 at 01:15:51PM +0200, Bjørn Mork wrote:
Aneurin Price <aneurin.price@gmail.com> writes:
In anything resembling a 'normal' system (ie. the kind where one might
be using the defaults) I would say that the tmpfs correlation is so
strong as to be very nearly 1:1, and this seems like the crux of the
matter; that is after all the reason that these applications are
failing when /tmp is switched to tmpfs.
I agree that's likely for any system using a default disk layout, so my
comment was irrelevant for this discussion.

I agree as well. This is the main reason why I didn’t like tmpfs to be the default. In most desktop cases you won’t have disk space problems. Even with multiple partitions you can easily spare 20 - 30 GB for a separate tmp partition.

I still think that the easy tmpfs resizing (no meta data update, no LVM
requirements, can use available space on other file systems) makes it
superior for /tmp.  But most users won't know that they can do this, so
we might need a daemon monitoring /tmp and doing ondemand resizing.

While you can resize tmpfs easily, you will never get sizes you would get with disks. And you must backup tmpfs with RAM and swap, so you can’t simply say, I resize my tmpfs to 20 GB if you only have 4 GB RAM and 8 GB swap (but a 2 TB disk).

Since you can’t change the partition layout on the fly to grow the swap partition, your daemon would have to create swap files and activate them according to the tmpfs needs. But there will you place these files? You must make sure that the daemon deletes them if they are not needed anymore. After a system crash they must be deleted, or your system will have less and less disk space because orphaned swap files are filling the disk.

Will this be worth the trouble? I don’t think so.

If you see an advantage having /tmp on tmpfs, you can manually do so. Then you know what you have done. I don’t care if we get a new /tmpfs together with /tmp, so the user has both choices to set TMDPIR according to his needs. We may even patch some applications creating small shortlived temporary files to use /tmpfs instead in Debian. But by default we should not give up disk based /tmp for a default installation.


| Stephan Seitz          E-Mail: stse@fsing.rootsland.net |
| Public Keys: http://fsing.rootsland.net/~stse/keys.html |

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply to: