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
?
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.