How to increase tmpfs filesystem in Linux ?

Today in this post, we will see how to increase tmpfs filesystem in Linux.

tmpfs as its name suggests is a temporary memory based filesystem and uses the system memory for processing.

The benefit of this Filesystem is that RAM is much faster than hard disk and your temporary data can be processed much faster which you tend to save on any of the temporary filesystem.

Lets see step by step how to increase tmpfs filesystem.

1. Check out current tmpfs size.

[root@ngelinux19 grub]# df -h /dev/shm
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           126G   24G  103G  19% /dev/shm
[root@ngelinux19 grub]#

[root@ngelinux20 ~]# free -g
             total       used       free     shared    buffers     cached
Mem:           251         66        185          0          1         59
-/+ buffers/cache:          5        246
Swap:          127          0        127
[root@ngelinux20 ~]#


2. Remount the partition with new increased size.

[root@ngelinux19 grub]# mount -o remount,size=170G /dev/shm

[root@ngelinux19 grub]# df -h /dev/shm
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           170G   24G  147G  15% /dev/shm
[root@ngelinux19 grub]# 


3. Increase/Mention the size in fstab file to stay persistent after reboot.

[root@ngelinux19 grub]# cat /etc/fstab

# /etc/fstab
# Created by anaconda on Tue Nov 26 16:08:09 2019
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
UUID=87d80495-1d68-4582-b7f5-0b0527123d13 /                       ext4    defaults        1 1
UUID=2461cac9-18b0-465a-911f-844ccca76d6d /boot                   ext3    defaults        1 2
UUID=d6cbb68e-249d-40ad-8f2b-f6a9494c0ba0 /var                    ext4    defaults        1 2
UUID=e95562e6-a279-4557-993c-17a39eedb13b swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults,size=170G        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/vg00/lscratch                        /scratch                ext4    defaults        1 2
/dev/vg00/ltmp                            /tmp                    ext4    defaults        1 2
[root@ngelinux19 grub]#
0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments