Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My understanding is that running rm on a file simply unlinks it, marking the space as free in the filesystem. It should then follow that deleting one file always takes roughly the same amount of time (i.e. delete speed is proportional to number of files, not size of files).

So why does deleting a 15 GB file take over a minute with a simple rm file.tar.gz?

share|improve this question
What filesystem? – Shane Madden Sep 7 '12 at 3:23
On many file systems, each "block" of free space has to be "marked" free. Large files have more blocks. This is not true of all file systems though! – Chris S Sep 7 '12 at 3:25
@ShaneMadden good question; ext4 right now, but I've noticed it on other ext#'s as well. – Tom Marthenal Sep 7 '12 at 3:28
That's why every file should have it's own virtualized filesystem so the inodes can be blindly wiped super fast! <JEST> – thinice Sep 7 '12 at 3:56
Which filesystem would perform better at this case? I am right now using a portable drive to move large VM disks from one machine to another and rm taking forever is driving me nuts. – motobói May 6 '14 at 2:30
up vote 39 down vote accepted

It takes a constant amount of time to unlink a single block, but files beyond the size of a single block consist of multiple blocks linked together, and the larger the file the larger the quantity of blocks that are linked.

share|improve this answer
<BSD Zealot> mumble mumble UFS mumble mumble soft updates mumble mumble delete stuff faster mumble mumble pancakes! </BSD Zealot> – voretaq7 Sep 7 '12 at 3:45
XFS deletes large files very rapidly, but large numbers of small files very slowly. – Andrew Sep 7 '12 at 4:37
One file will always just use one inode. It does use multiple data blocks. – Simon Richter Sep 7 '12 at 7:58
One block to rule them all, one block to find them, One block to bring them all and in the darkness bind them. – Rqomey Sep 13 '12 at 20:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.