tmpfs is a temporary file system that stores data in virtual. It does not create an file or directory on your hard drive. If you umnount and remount tmpfs file system all the files and directory residing in it are lost permanently.
tmpfs is similar to ramfs and RAM disk but with a few additional features. tmpfs is able to grow or shrink its space to accommodate files,and it can use swap space to store unneeded data. ramfs and RAM disk doesn’t have this capability.
In this article I will show you how to resize tmpfs on Linux machine.
Resize TMPFS
1. Login to you server with root access.
2. Check the current volume information using df command like below:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/simfs 3.0G 2.6G 505M 84% /
none 3.6G 4.0K 3.6G 1% /dev
tmpfs 3.0G 3.0G 0.0G 100% /dev/shm
3. Next check how much tmpfs space is beeing used using du command like below.
# du -sh /dev/shm/ 3G /dev/shm/
As you can see tmpfs 100% is used.
4. Lets resize the tmpfs volume by remounting it with a new size parameter. Make sure that the size is at least twice as large as current usage.
# mount -o remount,size=6G,noexec,nosuid,nodev,noatime /dev/shm
5. Verify the made changes using df command.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/simfs 3.0G 2.6G 505M 84% /
none 3.6G 4.0K 3.6G 1% /dev
tmpfs 6.0G 3.0G 3.0G 50% /dev/shm
6. Edit the /etc/fstab file to make this changes permanently.
# vim /etc/fstab
none /dev/pts devpts rw 0 0
tmpfs /dev/shm tmpfs size=6G,noexec,nosuid,nodev,noatime 0 0
Save and close file. You can also run mount command to apply changes in /etc/fstab file.
# mount -a
If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.
If I want to remount /run 1GB, command is mount -o remount,size=1G,noexec,nosuid,nodev,noatime /run , Right?