Resizing a tmpfs partition without losing the files

Took me just a few seconds of Googleing, but it seems worth taking a note here.

To resize a tmpfs filesystem without losing the files. Assuming that /tmp is being mounted in a tmpfs.

You can do it so it lasts until next reboot with:

mount /tmp -o size=3000M,remount

Or you can do it so it lasts forever :

  1. Modify /etc/fstab line to look something like this:
    none                   /tmp                tmpfs   size=3g        0 0
  2. Remount the filesystem
    # mount -o remount /tmp
  3. Check if it all went OK
    # df -h

Note: Increasing too much can cause the system to hang if the amount cannot be allocated.

References (hope at leat one of these links still work):

Leave a comment

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.