Hello,
A quick question.. If I do a rm on a file, is that file then gone forever or si it somewhere else? Suppose that every day a file of 10MB gets created, then deleted (with rm). Will I have a full 'recycle bin' at some stage or is the file really gone?
It's pretty much gone forever (though there have been recent threads in the unix forums which suggested ways in which to recover recently deleted files which sounded interesting). Once the parts of the disk the file was written to have been overwritten, there's no going back I'm afraid. HTH.
Depends on what you mean by really gone and also depends upon your file system, your os, and rm itself.
First: traditional Unix:
When you rm a file all that happens is that the directory entry is set to point at 0 instead of the inode it did point at, and the link count for the inode is decremented by one. If the link count has reached 0, and no process has the file open, then the inode itself is marked us unused, and the disk blocks that the file used are returned to the free list. If a process has the file open then the release of the inode and the reclaim of disk blocks waits until the process is done.
So, at this point, your data is still there until some other process needs disk blocks and these happen to get reused. If nothing asks for new blocks, or these blocks get put at the end of the free list, you might be able to recover the data by scrounging through the free list.
Secure Unix systems may zero disk blocks before releasing them to the free list; you wouldn't have any way to get your data if that was in effect.
Now: Some file systems have various schemes to keep "versions" of your data or to provide an undelete feature. In that case, older copies of your data maty still be there. However, even if your file system supports something like that, it may not be turned on by default: see
You could of course (if you have enough space) mv the rm command and replace it with your own script that move the file to another directory, called trash like on Tru64.
Thank you very much everybody. I was actually not looking to recover anything but a bit concerned that my box could crash if it filled up withold 'deleted' files. As this doesn't seem to be the case I can relax...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.