If touch returns “No space left on device” while df -h shows the partition is mostly empty, you are out of inodes, not bytes — run df -i on the mount that holds /home and read the IUse% column. Before you plan any fix, find out whether that mount is ext4 or XFS, because the two fail for different reasons and only one of them has a cleanup that actually ends the incident.
What you’ll accomplish
- Confirm in two commands that this is an inode problem, and on which mount.
- Establish whether
/homeis ext4 (a fixed inode table, sized at format time) or XFS (inodes allocated on demand) — this changes the whole diagnosis. - Walk top-down to the exact directory holding the files, in a few steps rather than one command that runs for an hour.
- Clear the usual cPanel offenders — PHP sessions, Maildir, the Exim spool, File Manager trash, application caches — without logging users out mid-request or corrupting a mailbox.
- Leave the box with the cause fixed, not just the symptom cleared.
Prerequisites
- Root SSH on the cPanel server. An account-level cPanel login can see File Usage in the Statistics sidebar (if the host enabled it) but cannot run
df -ior see the other tenants. - cPanel & WHM on a current EL-family host — AlmaLinux, Rocky, or CloudLinux 8/9. Every command below assumes GNU coreutils and findutils. On a BusyBox rescue shell or a minimal container,
du --inodesandfind -printfdo not exist; the Troubleshooting section has the portable fallback. - A snapshot or a current backup of the account before any bulk delete. The pressure to move fast is exactly when the wrong path gets typed.
- The offending cPanel username where commands below say
<user>, and the active PHP version where they sayea-php82.
How it works
An ext4 filesystem carries two independent budgets. Data blocks hold file contents and grow with the size of what you store. The inode table holds one fixed-size slot per file, directory, symlink, and socket — and mke2fs lays that table down when the filesystem is created, sized from the inode_ratio in mke2fs.conf. The shipped default is one inode per 16,384 bytes of filesystem (the small usage type drops it to 4,096). A 200 GB /home therefore gets roughly 13 million inode slots, permanently.
A 40-byte PHP session file consumes exactly the same one slot as a 4 GB video. That is the whole failure: a tenant can burn every slot on the volume while using a fraction of a percent of the bytes.
On ext4 the table cannot be widened in place. tune2fs has no option to change the inode count or the bytes-per-inode ratio; -I changes the inode size in bytes, which is a different thing. Growing the volume with resize2fs does add inodes, because each new block group carries its own fixed number of them — but at the ratio chosen at mkfs time, so a volume formatted sparsely stays sparse. Changing the ratio means a new filesystem and a data migration.
On XFS the story is different. XFS allocates inodes dynamically from free space, so it does not run out this way. It only caps the share of the filesystem inodes may occupy — imaxpct, which xfs_info prints and which defaults to 25% on filesystems under about 1 TB. Because that ceiling floats with free space, df -i on XFS reports an estimate that moves as the volume fills; a percentage there is not the hard budget it is on ext4.
What cPanel does and does not do here. cPanel & WHM ships no inode management interface. WHM’s Modify an Account exposes Disk Quota (MB) — a block quota — and nothing for file counts. Where a host does enforce per-account inode limits, those are ordinary filesystem quotas set outside cPanel with setquota on ext4 or xfs_quota on XFS; cPanel only displays them, in the account’s Statistics sidebar under File Usage, and only after WHM → Tweak Settings → Display File Usage information in the cPanel stats bar (inode count) is switched on. cPanel’s own Disk Usage screen is a bytes-and-directories view. During an inode incident it will look completely calm, which is why tickets arrive worded as “I have space, why can’t I upload”.
Step-by-step
1. Confirm it is inodes, and on which mount. Run both, on the mount that actually holds /home — on many cPanel builds /home is its own volume, on others it is part of /.
df -h /home
df -i /home
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg0-home 197G 16G 172G 9% /home
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/vg0-home 13107200 13107200 0 100% /home
IUse% at 100% with Use% in single digits is the diagnosis, full stop. If IUse% is comfortable, stop here — you have a different problem.
2. Establish the filesystem type before planning anything.
findmnt -no SOURCE,FSTYPE,TARGET /home
/dev/mapper/vg0-home ext4 /home
On ext4, read the fixed geometry and work out the ratio you were given:
tune2fs -l /dev/mapper/vg0-home | grep -E 'Inode count|Free inodes|Inodes per group|Inode size|Block count|Block size'
Inode count: 13107200
Block count: 51609600
Block size: 4096
Inodes per group: 8192
Inode size: 256
Free inodes: 0
Block count times block size divided by inode count gives the bytes-per-inode ratio the volume was formatted with — 16,384 here, the default. On XFS, use xfs_info instead and note imaxpct:
xfs_info /home
meta-data=/dev/mapper/vg0-home isize=512 agcount=4, agsize=12345678 blks
data = bsize=4096 blocks=49382712, imaxpct=25
3. Split whole-partition from single-account. Roll the tree up one level at a time rather than counting the whole thing at once. du --inodes counts slots instead of bytes, and -x keeps it from wandering onto another filesystem.
du --inodes -x -d 1 /home 2>/dev/null | sort -n | tail -15
41823 /home/clientb
96774 /home/clientc
12904118 /home/clienta
13006932 /home
One account carrying nearly the whole count is the easy case. If the total is spread across many accounts, or if /home’s total is far below the partition’s IUsed, the shortage is not a tenant’s — run the same command against / and /var, and include /var/spool/exim and /var/cpanel/php/sessions. That is the host’s incident, not the account owner’s.
4. Descend to the directory. Repeat step 3 one level deeper each time. Three or four iterations is normal, and each is fast because you never traverse a branch you already ruled out.
du --inodes -x -d 1 /home/clienta 2>/dev/null | sort -n | tail -8
du --inodes -x -d 1 /home/clienta/public_html 2>/dev/null | sort -n | tail -8
Avoid the one-shot find /home -xdev -printf '%h\n' | sort | uniq -c | sort -rn on a tree this size: it feeds one line per file into sort, which spills to a temporary directory that is itself on a filesystem with no inodes left.
5. Match the directory to the offender. The recurring ones on a cPanel box:
/var/cpanel/php/sessions/ea-php82/— where EasyApache 4 PHP writes sessions by default. Note it is not under/home, so it burns inodes on/or/varand never shows in an account’s usage./home/<user>/.cagefs/tmp/on CloudLinux — CageFS gives each account a private/tmp, which lives inside the home, so those session files do land on/home(older CageFS builds used~/.cagefs-tmp)./home/<user>/tmp/— the per-account tmp directory some stacks are configured to use instead./home/<user>/mail/<domain>/<localpart>/{cur,new,tmp}— Maildir, one inode per message plus Dovecot index files. A 400,000-message archive is 400,000 inodes./var/spool/exim/input/— the mail queue, split across0–9anda–fsubdirectories, two files per queued message (-Henvelope and-Dbody). A spam run through a compromised account leaves millions./home/<user>/.trash/— cPanel File Manager’s trash. Deleting through the web UI moves files here and frees nothing./home/<user>/.cpanel/caches/and.cpanel/datastore/— cPanel’s own per-account caches.- Application caches:
wp-content/cache/, Magento’svar/cache/andvar/page_cache/,~/.cache/composer/.
6. Clean the offender, safely. For PHP sessions, prefer cPanel’s own script — it reads session.save_path and session.gc_maxlifetime out of the PHP configuration and removes only files matching sess_*:
/usr/local/cpanel/scripts/clean_user_php_sessions
If you need a faster, narrower cut, filter by age rather than deleting everything. Removing a live session file under a running PHP-FPM pool logs that visitor out mid-request:
find /var/cpanel/php/sessions/ea-php82 -type f -name 'sess_*' -mmin +1440 -delete
For a directory with millions of entries, do not reach for rm -rf: it grinds through an unlink loop that can pin a core and the disk queue for a long stretch with no progress output. Two better options — rsync against an empty directory is usually the fastest, and is safe to interrupt and resume:
mkdir -p /root/empty
rsync -a --delete /root/empty/ /home/<user>/public_html/var/cache/
nice -n 19 ionice -c 3 find /home/<user>/wp-content/cache -mindepth 1 -delete
For mail, never delete from a Maildir while Exim is delivering into it or Dovecot is indexing it — you will leave the index disagreeing with cur/ and the user’s client resyncing everything. Use the tools that take the lock:
doveadm expunge -u user@example.com mailbox Junk savedbefore 30d
For a queue blown up by a spam run, drop only what is genuinely stale:
exim -bpc
exiqgrep -o 604800 -i | xargs -r -n 200 exim -Mrm
7. Remove the cause, not just the files. Confirm PHP session garbage collection actually runs — a session.gc_probability of 0 means it never fires and the cPanel cron is doing all the work. Move sessions off the filesystem where the account justifies it: switching the PHP session handler to Redis on cPanel. Disable the plugin or cron writing the files. Then set per-account file limits so the next occurrence is contained rather than fatal — disk quotas and inode limits on cPanel covers how.
Validate it works
Re-read the budget that was exhausted, not the one that was fine:
df -i /home
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/vg0-home 13107200 201430 12905770 2% /home
Prove a write succeeds as the account user rather than as root — root has the reserved-blocks escape hatch and can succeed where the tenant still fails:
sudo -u <user> touch /home/<user>/public_html/.inode-check && echo WRITE_OK
sudo -u <user> rm -f /home/<user>/public_html/.inode-check
Then confirm the count is where you expect per account, and that no second offender is sitting just behind the first:
du --inodes -x -d 1 /home 2>/dev/null | sort -n | tail -10
repquota -s /home | head -20
On XFS the quota report comes from a different tool:
xfs_quota -x -c 'report -i -h' /home
Troubleshooting
-
You deleted millions of files and
df -idid not move. A running process still holds the deleted files open; the kernel does not free an inode until the last descriptor closes. Find the holder withlsof +L1 | head -30— it lists open files whose link count has dropped to zero — then restart that service (a PHP-FPM pool, Exim, a stuck cron job). Also confirm you measured the filesystem you cleaned: a bind mount or a nested volume shows a differentdf -i. -
cPanel says the account is nowhere near its quota, but writes still fail. Different failure, different owner. The account’s quota is a block quota and says nothing about the shared inode pool on the partition. If
df -iis at 100% and the account holds only a small share of the count, some other tenant — or a system directory like the Exim spool — filled the volume. Roll up every account before touching the one that opened the ticket. -
The files come back faster than you delete them. Something is regenerating them: a cron entry, a plugin with a broken cache key writing a unique file per request, a bot hitting an endpoint that starts a session on every hit. Stop the writer first, or you will delete for hours and end where you started. Check
crontab -l -u <user>and/var/spool/cron/<user>, and time the arrivals withls -lt --time-style=full-iso <dir> | head. -
du: unrecognized option '--inodes'orfind: unknown predicate '-printf'. You are on BusyBox or a stripped image — a rescue environment, a container, an appliance. Both options are GNU-only. The portable fallback is slower but works everywhere:for d in /home/*; do echo "$(find "$d" -xdev 2>/dev/null | wc -l) $d"; done | sort -n | tail. -
df -ion XFS reports odd or shifting numbers. Expected: XFS has no preallocated table, so the reported total is an estimate derived from free space andimaxpct. If an XFS volume really is refusing inode allocation with blocks free, checkxfs_infoforimaxpctand whether the mount predatesinode64; the ceiling can be raised on a mounted filesystem withxfs_growfs -m.
When this is the wrong approach
Cleanup is the right move for an incident, not for a pattern. If the same volume has hit 100% inodes three times this quarter, deleting files again defers the real decision. On ext4 there is no in-place remedy: no tune2fs option changes the ratio, and resize2fs only adds inodes at the ratio the volume was born with. The fix is a rebuild — a new filesystem with mkfs.ext4 -i 4096 (or an explicit -N), or a move to XFS so inodes come from free space instead of a fixed table — then migrating the accounts across. That is a maintenance window and a data move, and it belongs on a change plan, not in an incident channel at 2 a.m.
It is also wrong when the files are legitimate. A tenant with four million real messages in a Maildir does not have a cleanup problem; they have an account on a volume that was never sized for them. Deleting there destroys customer data to buy a week.
And if you are the account holder rather than the host, you can clean your own home directory and nothing else. When df -i is out at the partition level, only the server operator can see the other tenants and the system spools — open a ticket with the df -i output rather than deleting more of your own files in the hope it helps.
Reference: cPanel’s own write-up on managing inode quotas and inode usage, and the mke2fs.conf(5) manual page for the inode_ratio defaults.
If this is the kind of work you’d rather never own again, it’s the daily job of Managed Cloud Ops — book an infrastructure review.