Skip to main content
Crusoe Support Help Center home page
Crusoe

How-To Resize tmpfs Filesystem on Crusoe Virtual Machine

Sagar Lulla
Sagar Lulla
Updated

Last Updated: Dec 15th, 2025

Introduction

This guide explains how to resize a tmpfs filesystem on a Crusoe Virtual Machine. tmpfs is a temporary file storage system that resides in volatile memory (RAM), offering high-speed I/O operations for temporary files. You may need to resize tmpfs when applications require more temporary storage space or when the default allocation is insufficient for your workload requirements.

Prerequisites

Before starting this task, ensure you have:

  • Access to a Crusoe VM with sudo or root privileges
  • Understanding of your application's memory (RAM) requirements to avoid performance degradation
  • Knowledge of which tmpfs mount points need resizing
  • Sufficient available RAM on your system to accommodate the increased tmpfs size

Step-by-Step Instructions

1. Verify Current tmpfs Usage

Before making any changes, check the current size and usage of your tmpfs mounts to identify which ones may need resizing.

df -hT | grep tmpfs

Example Output:

tmpfs          tmpfs    6.8G  1.2M  6.8G   1% /dev/shm
tmpfs          tmpfs    2.8G  8.0K  2.8G   1% /tmp
tmpfs          tmpfs    1.4G  1.1M  1.4G   1% /run
  • Review the output to identify mount points that are approaching capacity
  • Note the current sizes and usage percentages
  • Common tmpfs mount points include /tmp, /run, /dev/shm, and /run/lock

2. Resize tmpfs Temporarily

Resize the tmpfs mount temporarily for immediate relief. This change will only persist until the next reboot.

sudo mount -o remount,size=<NEW_SIZE>G tmpfs <MOUNT_POINT>

Example (resizing /tmp to 8GB):

sudo mount -o remount,size=8G tmpfs /tmp
  • Replace <NEW_SIZE>G with your desired size (e.g., 8G for 8 gigabytes)
  • Replace <MOUNT_POINT> with the specific tmpfs mount point you want to resize
  • Verify the change by running df -hT | grep tmpfs again

3. Make Resizing Persistent

To ensure the new size persists across reboots, add or update the corresponding entry in the /etc/fstab file.

First, create a backup of your current /etc/fstab:

sudo cp /etc/fstab /etc/fstab.backup

Then edit the /etc/fstab file:

sudo nano /etc/fstab

Example (setting /tmp to 8GB permanently): Add or modify the following line in /etc/fstab:

tmpfs   /tmp   tmpfs   defaults,size=8G   0   0
  • If an entry for the mount point already exists, update the size parameter
  • If no entry exists, add a new line with the format shown above
  • Save and exit the editor

4. Test the Configuration

Test your /etc/fstab configuration without rebooting:

sudo mount -a

If there are no errors, verify the changes:

df -hT | grep tmpfs

Example

Scenario: A development server running build processes requires more space in /tmp for compilation artifacts.

Current State:

tmpfs          tmpfs    2.8G  2.5G  300M  90% /tmp

Action Taken:

  1. Temporarily resize /tmp to 8GB:

     
    sudo mount -o remount,size=8G tmpfs /tmp
  2. Add permanent configuration to /etc/fstab:

     
    tmpfs   /tmp   tmpfs   defaults,size=8G   0   0

Result:

tmpfs          tmpfs    8.0G  2.5G  5.5G  32% /tmp

The /tmp filesystem now has sufficient space for build processes, and the configuration will persist across reboots.

Troubleshooting

Issue: Mount command fails with "device or resource busy" error

  • Resolution: Some processes may be using files in the tmpfs. Use lsof /tmp to identify processes and safely stop them before remounting.

Issue: System becomes slow or unresponsive after resizing

  • Resolution: The tmpfs size may be too large for available RAM. Reduce the size and ensure you have adequate free memory.

Issue: Changes don't persist after reboot despite updating /etc/fstab

  • Resolution: Some tmpfs mounts are managed by systemd. Check if systemd is overriding your configuration and may require additional systemd tmpfiles configuration.

Issue: Permission denied when editing /etc/fstab

  • Resolution: Ensure you're using sudo when editing system configuration files.

Important Cautions

  • Volatile Storage: tmpfs uses the system's RAM. Increasing its size reduces memory available for other processes and applications. Ensure sufficient free RAM to avoid system performance issues.
  • Data Persistence: All data stored in a tmpfs filesystem is lost when the virtual machine is rebooted or shut down. For persistent storage, use disk-based directories like /var/tmp.
  • Systemd Interaction: Some tmpfs mounts (e.g., /run/lock) may be managed by systemd. Changes made directly in /etc/fstab might be overridden, requiring additional systemd configuration.
  • Safe Temporary File Handling: Since directories like /tmp are often world-writable, always use secure methods for creating temporary files to avoid conflicts or security vulnerabilities.

Additional Resources

Related to

Was this article helpful?

0 out of 0 found this helpful

Still need help?

Our support team is ready to assist you with any questions.

Have more questions? Submit a request

Recently Viewed

Comments

0 comments

Article is closed for comments.