Does using "rm" command cause journaling corruption?
Some time ago I had some problems with my Mac drive, so I went to the recovery partition and used Disk Utility to check for problems. It reported a huge discrepancy between the journaled free blocks and the actual free blocks, in the case of gigabytes.
I was wondering what may have caused this problem, and I remembered deleting a huge hierarchy of folders using rm -rf
, and since this command is almost instantaneous, I thought it may have caused this problem.
Does this make any sense? Should I avoid using this command on OS X with a Journaled drive?
NOTE FOR CASUAL READERS:
rm -rf
destroys data. Use with caution.
rm -rf
may appear to go fast, but it is actually recursively going depth-first into each directory and unlinking the files within—the same operation that is used for any file deletion on Unix systems.
You can see how rm -rf
works by adding the -v
flag, e.g. rm -rfv
.
There's no reason to believe that rm
itself is responsible for journaling failures. It's a proven and safe command that does not have any low-level access to the disk.
It is possible that the access pattern created triggered some bug in HFS+, but that seems unlikely as well; I rm -rf
sizable trees of files on my machine frequently and haven't seen a problem.