Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm thinking about using zRam on my server. From what I've read about zRam, it apparently does everything tmpfs does and more.

Once zRAM is working, is there any reason to keep tmpfs around? Is there anything tmpfs does that zRAM can't do? Is there ever a reason to use tmpfs instead of or in addition to zRAM?

share|improve this question

You will get better performance from using zram for swap due to the compression that is possible.

zram-init makes zram simple to use. Remember to read the instructions.

Your kernel needs to be built with CONFIG_ZRAM_LZ4_COMPRESS enabled to be able to benefit from lz4 compression.

I use zram for swap & for /tmp (zram-init uses sensible default mount options for /tmp):

root@alpine [~]# cat /proc/swaps
Filename                Type        Size    Used    Priority
/dev/vda7                               partition   1045500 0   -1
/dev/zram0                              partition   1048572 0   16383
root@alpine [~]# mount|grep zram
/dev/zram1 on /tmp type ext4 (rw,nosuid,nodev,noexec,discard)

There are still use cases for using tmpfs. I use these for bind mounting volumes with secure mount options into lxc containers:

root@http [~]# mount|grep tmpfs
tmpfs on /var/www/ type tmpfs (ro,nosuid,nodev,relatime,size=200k)
tmpfs on /var/www/domain.comm/dev type tmpfs (rw,nosuid,relatime,size=4k,mode=755)
share|improve this answer
What you say is true. But I don't see how it's relevant to my question about tmpfs. Did you perhaps mean to post this as an answer to some other question? – David Cary Feb 4 at 4:23
@David Cary - answer expanded – Stuart Feb 4 at 17:54
Is "There is never any reason to use tmpfs. Instead, zram is just as easy to use and gives better performance" a valid summary? Because I'm not seeing any reasons to use tmpfs in your answer. (It may be obvious to you the reasons why using tmpfs is a great idea "for bind mounting volumes with secure mount options into lxc containers", but I wish you would tell me what those reasons are. Or is there no actual reason, and you're still doing it that way only because you haven't had time to convert that system zram?) – David Cary Feb 8 at 0:08
perhaps you should try actually using them both. – Stuart Feb 9 at 1:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.