No. rm
just calls unlink()
to remove the name. This syscall is atomic, meaning it either succeeds in removing the name, or does not. It can not be interrupted. If you interrupt rm while it is unlink()
ing multiple files, then some files will be successfully removed, and some will not be. Housekeeping such as freeing the blocks the file was using if all links have been removed is a separate operation and may be done later, and if this is interrupted ( by a power failure or system crash, not interrupting rm
), the filesystem may require a fsck
to finish it, but most filesystems these days are journaled so they do not need this. Either way, the file is either removed, or not, there is no in between.
Hmm... To be more clear, would interrupting rm during a huge file delete cause corruption (if only half the file was deleted?) I'd find this unlikely if it only removes references, but I need to be sure. – Jookia – 2013-01-26T01:39:10.147
If you need to be sure, then run a check using hashes. Trust but verify. – peelman – 2013-01-26T01:48:12.240
1Eh, I don't think I have a slow enough computer to test the hypothesis. I'll go read the source code. – Jookia – 2013-01-26T01:50:46.633