How to resize tmpfs without losing data
Definition from Wikipedia: tmpfs is a temporary file storage paradigm implemented in many Unix-like operating systems. It is designed to appear as a mounted file system, but the data is stored in volatile memory rather than on a persistent storage device. A similar construction is a RAM disk, which appears as a virtual disk drive and hosts a disk file system.
To resize tmpfs without lose any data, remount it instead of umount tmpfs and mount it again. It is also possible to increase or decrease the size.
The syntax:
mount -o remount,size=new_size /path/to/tmpfs
Real life examples:
mount -o remount,size=500M /tmp
mount -o remount,size=2G /var/log
If you have more data on tmpfs than you are trying to limit, you will get an error message:
mount point not mounted or bad option.
Comments