(AlmaLinux 9 / CloudLinux 9 Compatible)
π Introduction
On AlmaLinux 9 and CloudLinux 9 systems running cPanel, the /tmp filesystem is often mounted as a loopback device (e.g. /dev/loop0) and managed by /scripts/securetmp. By default, itβs 4GB or 5% of /usr, whichever is smaller. This guide explains how to increase that limit safely and permanently.
β οΈ Important Notes
- Advanced knowledge is required. Proceed with caution.
- Only applies to servers using the cPanel loopback-based
/tmpmount. Confirm with:df -h /tmpβ Sample correct output:Filesystem Size Used Avail Use% Mounted on /dev/loop0 4.0G 2.0G 2.0G 50% /tmpβ If it says/dev/sdaXor another physical mount, stop here and consult your provider. - Not supported on Virtuozzo/OpenVZ containers.
- Performed and tested on AlmaLinux 9 and CloudLinux 9 (EL9-based) systems using systemd.
π οΈ Procedure
1. Connect to the Server
SSH in as root or access the WHM Terminal.
2. Edit /scripts/securetmp
Open the file in an editor:
nano /scripts/securetmp
3. Change the tmpdsksize Value
Locate and update:
my $tmpdsksize = 10485760; # 10GB in kilobytes
Now comment out the following logic to prevent it from resetting your value:
# my $five_percent_of_available = ( $available * 0.05 );
# if ( $five_percent_of_available > $tmpdsksize ) {
# $tmpdsksize = $five_percent_of_available;
# }
# my $FOUR_GIG_k = ( 1024 * 1024 * 4 );
# if ( $tmpdsksize > $FOUR_GIG_k ) {
# $tmpdsksize = $FOUR_GIG_k;
# }
Save and exit (Ctrl+O, Enter, Ctrl+X).
4. Identify Active Services Using /tmp
Run:
lsof | grep /tmp | grep -v deleted
5. Disable Monitoring of Key Services (Temporarily)
whmapi1 configureservice service=cpsrvd enabled=1 monitored=0
whmapi1 configureservice service=mysql enabled=1 monitored=0
whmapi1 configureservice service=httpd enabled=1 monitored=0
6. Stop Services
/scripts/restartsrv_cpsrvd --stop
/scripts/restartsrv_mysql --stop
/scripts/restartsrv_httpd --stop
7. Unmount /tmp and /var/tmp
umount -l /tmp
umount -l /var/tmp
8. Backup Old tmpDSK File
mv /usr/tmpDSK /usr/tmpDSK_bak
9. Recreate the /tmp Filesystem
Run:
/scripts/securetmp
This recreates /usr/tmpDSK with the new size and mounts /tmp and /var/tmp securely.
10. Restart Services
/scripts/restartsrv_cpsrvd --start
/scripts/restartsrv_mysql --start
/scripts/restartsrv_httpd --start
11. Re-enable Service Monitoring
whmapi1 configureservice service=cpsrvd enabled=1 monitored=1
whmapi1 configureservice service=mysql enabled=1 monitored=1
whmapi1 configureservice service=httpd enabled=1 monitored=1
β Final Checks
- Verify new
/tmpsize:df -h /tmp - Monitor error logs and service behavior for 15β30 minutes post-change.
π Notes for EL9 Environments
- AlmaLinux 9 and CloudLinux 9 use systemd and XFS or ext4 by default.
- This method avoids editing
fstabor mounting options manually. - If your server uses
/etc/systemd/system/tmp.mountor has custom mounts, double-check those settings.
