Cookie

Resize tmpfs in Linux without unmounting

Published by TheJoe on

Estimated reading time: < 1 minute

Today we see a quick solution to resize a resource formatted with tmpfs quickly, without rebooting or losing data. This is the case of complex server applications, but it's also my case. For a few months I have been using Solus as the operating system on the laptop to my great advantage since the laptop is not fast, not recent.

Solus has the peculiarity of mounting the directory /tmp in a separate partition (inside the RAM) con filesystem tmpfs. This greatly speeds up writing such data to the system, but if the RAM is not sufficiently capable you risk getting the classic error “Out of disk space”.

$ df -h
File system                   Dim. Usati Dispon. Uso% Montato su
/dev/mapper/SolusSystem-Root  454G  259G    172G  61% /
devtmpfs                      4,0M     0    4,0M   0% /dev
tmpfs                         1,9G     0    1,9G   0% /dev/shm
tmpfs                         776M  9,6M    766M   2% /run
tmpfs                         1,9G  332K    1,9G   1% /tmp
/dev/sda1                     449M  151M    269M  36% /boot
tmpfs                         388M  2,7M    386M   1% /run/user/1000

That's what happened to me. The solution is very simple:

# mount -o remount,size=new_size /path/to/tmpfs

This solution preserves the data and if the size we are trying to set is larger than the space available in RAM the data will then be written to disk in the SWAP partition.

Look here:  Songbird music changes, no longer support GNU / Linux

TheJoe

I keep this blog as a hobby by 2009. I am passionate about graphic, technology, software Open Source. Among my articles will be easy to find music, and some personal thoughts, but I prefer the direct line of the blog mainly to technology. For more information contact me.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.