/tmp and tmpfs

I have seen recommendations for using tmpfs for /tmp. I understand that tmpfs uses ram and also swap. I have not seen any recommendations as to size. From reading various things it appears to me that tmpfs is limited to less than the size of the machines ram with a default of 50%. If my understanding is correct then moving /tmp to tmpfs would give major problems. I have an 11.3 machine and just copying a dvd seems to create a 5GB temp file. This would exceed the default size even on an 8GB machine. I have seen references to tmpfs sizes up to 40 GB but they are always less than the size of the physical memory. My 11.3 machine has 4GB of ram and about 50GB of /tmp. 50GB is too much but it is a nice round number. I would be happy to reduce it to about 20GB but not much less.

I clearly do not understand how tmpfs works. Can anybody explain how it works or point me at some good documentation. I would like to use tmpfs if it will use lots of swap as swap io is much faster than ext4, etc

On 2012-02-18 13:06, vindevienne wrote:

> If my
> understanding is correct then moving /tmp to tmpfs would give major
> problems. I have an 11.3 machine and just copying a dvd seems to create
> a 5GB temp file.

Indeed, but you should be able to tell that program to use another path for
temporary storage. But it is the reason I do not use tmpfs, the needs for
tmp space can be tremendous.

> My 11.3 machine has
> 4GB of ram and about 50GB of /tmp. 50GB is too much but it is a nice
> round number. I would be happy to reduce it to about 20GB but not much
> less.

I really have much less, whatever is free in root; currently 14 GiB, but it
has been 2 GiB at times.

> I clearly do not understand how tmpfs works. Can anybody explain how it
> works or point me at some good documentation. I would like to use tmpfs
> if it will use lots of swap as swap io is much faster than ext4, etc

I don’t know if the end result is faster or not. It can be, because it
works as if you have a tmp directory with a dedicated ram cache. On the
other hand, you are removing ram from the filesystem cache, so it may even out.

One detail I learnt is that tmpfs does not commit memory usage first, but
only when needed, up to the maximum defined. I think that the idea was to
be used for small file usage. Many and small, not large files.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Thank you for your quick reply. I got a little confused as I have seen several recent posts saying just convert /tmp to tmpfs without any warning that it might cause problems with a standard opensuse installation. I have /tmp at the start of a separate disk that otherwise contains relatively low usage data. I might look at file system options for /tmp. I think at times I might over complicate things and set this linux system up like an AIX or SOLARIS database server.