:: Re: [DNG] use zram for /tmp - how?
Página Principal
Delete this message
Reply to this message
Autor: Adam Borowski
Data:  
Para: dng
Assunto: Re: [DNG] use zram for /tmp - how?
On Sat, Jun 04, 2016 at 10:17:58PM +0200, parazyd wrote:
> For /tmp I would definitely use tmpfs.
> It's as simple as adding an entry to the fstab
>
> tmpfs /tmp tmpfs nodev,nosuid,size=2G 0 0
>
> In this example, your /tmp will be 2 gigabytes big, but tmpfs will keep
> your /tmp in RAM, while not cutting off the entire 2GB of your system's
> RAM. It will only use as much as it needs.


And when the tmpfs has files in it but you need the memory for something
else, files that haven't been accessed recently will be prime candidates for
moving into swap. This is far more efficient than using a real filesystem:
those put massive effort for ensuring consistency in case of a crash.

If you want big /tmp, it's a good idea to enlarge your swap and set tmpfs's
size to a value larger by that much.


Using zram for /tmp has a big problem: the data can never be evicted to
actual on-disk swap no matter how old it is. This might be ok if you have
plenty of memory and don't believe in swap. If you put a filesystem on it,
you really want to disable costly features used for crash protection: on
ext4, mkfs -O ^has_journal, and so on.


Meow!
--
An imaginary friend squared is a real enemy.