If you're encountering the error:
Sorry for the inconvenience,
The filesystem mounted at /tmp on this server is running out of disk space. (Free space is 0 MB)
Please check the server space and try again.
…it means the /tmp
partition on your server is full. This is common on servers using a loopback-mounted /tmp
device, such as /dev/loop0
, typically around 3.2 GB by default.
This issue can cause PHP sessions to break, webmail to stop working, and cPanel services to behave unpredictably.
In this guide, we’ll walk through how we fixed this issue by safely resizing /tmp
on a cPanel server.
Step 1: Confirm the Issue
Run the following command:
df -h /tmp
Example output:
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 3.2G 3.0G 32K 100% /tmp
If Use%
is at 100%, the partition is full and needs to be resized.
Step 2: Stop Services That May Use /tmp
To avoid file locks or corruption, stop major services temporarily:
systemctl stop httpd
systemctl stop exim
systemctl stop clamd
systemctl stop mysql
Step 3: Unmount and Remove the Old /tmp Loop Device
Unmount /tmp
and /var/tmp
:
umount -fl /tmp
umount -fl /var/tmp
Remove the existing loopback file:
rm -f /usr/tmpDSK
Step 4: Create a New, Larger /tmp (e.g., 6GB)
Use the following commands to create a new loop file:
dd if=/dev/zero of=/usr/tmpDSK bs=1M count=6144
mkfs.ext4 /usr/tmpDSK
Mount the new /tmp
:
mount -o loop,noexec,nosuid,rw /usr/tmpDSK /tmp
chmod 1777 /tmp
Bind it to /var/tmp
:
mount --bind /tmp /var/tmp
chmod 1777 /var/tmp
Step 5: Update /etc/fstab
for Persistence
Open /etc/fstab
:
nano /etc/fstab
Make sure the following lines are present (remove noauto
if it's there):
/usr/tmpDSK /tmp ext4 loop,noexec,nosuid,rw 0 0
/tmp /var/tmp none bind 0 0
Save and exit.
Step 6: Apply and Reboot
Apply system changes and reboot:
systemctl daemon-reexec
systemctl daemon-reload
reboot
Step 7: Verify the Fix
After the system reboots:
df -h /tmp
Expected output:
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 6.0G 200M 5.8G 4% /tmp
Bonus: Auto-Cleanup /tmp
with tmpwatch
Install and configure tmpwatch
to clean up stale files regularly:
yum install tmpwatch -y
Add this to your crontab:
echo "0 */6 * * * root /usr/sbin/tmpwatch --mtime --all 12 /tmp" >> /etc/crontab
This process restores stability to services relying on /tmp
, including PHP sessions, cPanel operations, and webmail.
Let us know if you need a script to automate this solution.
Still need help?
Contact us