Updated: 3 November 2026 · Applies to: Linux, tested with GNU coreutils and util-linux
To delete a huge file (100GB or more) without the delete itself slowing everything else down, run it through ionice so the delete only uses disk I/O that nothing else needs. If a running process still has the file open, deleting it will not actually free the disk space until that process closes it or restarts.
Why a huge delete can slow the server down
Removing a file does not need to read its contents, but on a busy server even the metadata work of freeing hundreds of gigabytes of disk blocks competes with every other process for I/O. ionice sets or shows the I/O scheduling class and priority for a command, so you can tell the kernel this particular delete should back off whenever something else needs the disk.
Delete a file at idle priority
Class 3 (idle) means the command only gets I/O when nothing else wants it. This is the safest option on a live server:
ionice -c 3 rm /var/log/huge-file.log
For a directory:
ionice -c 3 rm -rf /var/log/old-app-logs
Delete a file at a low best effort priority
If the server has little or no idle time, class 2 (best effort) with a low priority number (0 to 7, where 7 is lowest) still gets some I/O, just less of it than normal processes:
ionice -c 2 -n 6 rm /var/log/huge-file.log
Check what is actually holding the disk space
On Linux, deleting a file only frees space once every process with it open has closed it. A common cause of "I deleted a huge file but df still shows no free space" is a running service, commonly a log file a daemon is still writing to. Find out with:
lsof +L1
This lists open files with zero remaining hard links, which is exactly the state of a file you deleted while something still has it open. The fix is to restart or reload the service holding it, for example systemctl reload nginx, not to delete the file again.
Securely deleting a file instead of just unlinking it
A plain rm only removes the directory entry; the data can still be recovered until those blocks are reused. If the file held sensitive data, overwrite it first with shred, still run through ionice to avoid overloading the disk:
ionice -c 3 shred -u /var/log/sensitive-export.csv
The -u flag also deletes the file after overwriting it. Note that on an SSD, modern filesystems with journaling, or copy on write filesystems such as Btrfs and ZFS, overwriting in place does not reliably erase every physical copy of the data; full disk encryption at the volume level is the more reliable way to make old data unrecoverable on that kind of storage.
For every option ionice supports, see its manual page:
man ionice