Increase size of tmpfs file system

tmpfs filesystem keeps the entire filesystem (with all it’s files) in virtual memory. All data is stored in memory, which means the data is temporary and will be lost after a reboot. If you unmount the filesystem, all data in there is gone. Typically it is mounted to /dev/shm (b/c glibc expects it to be mounted there for POSIX shared memory). You can also find a lot of installations mounting it to /tmp and hence anything written to /tmp is wiped after a reboot.

The default size of the filesystem is half of the installed memory in the system.

To increase the size, do the following:

  1. Modify /etc/fstab line to look something like this:
    tmpfs                   /dev/shm                tmpfs   size=24g        0 0
  2. mount -o remount tmpfs
  3. df -h      (to see the changes)
  4. Note: Be careful not too increase it too much b/c the system will deadlock since the OOM (Out-Of-Memory) handler can not free up that space.


One Response to “Increase size of tmpfs file system”
  1. Niket Kumar says:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: