Why should I use "delete" instead of "rm"?
Context
- This article relates to the Athena computing environment
- Some of the information in this article applies to other Linux- and Unix-based systems as well, but much of it is Athena specific
Answer
Unfortunately, the effects of the 'rm' command are permanent: On a "standard" Unix system, there is no way to recover files that have been deleted with the 'rm' command.
Under the AFS locker system, you have a better chance of salvaging information than in the past. Every night, AFS takes a "snapshot" of your locker and stores it on a backup volume. If you accidentally 'rm' a file that you had the previous night, it can usually be retrieved from the backup volume. Read the stock answer How can I recover a file I just deleted from my locker? under the "UNIX" topic to see how to do this.
If you are unlucky enough to have your file on a non-AFS system, or to have just created the file you deleted, you might want to take some precautions to keep from having it occur again. If you want to prevent yourself from accidentally deleting files in the future, you can create an "alias" the for 'rm' command. For example, this command:
alias rm delete
...will cause 'rm' to use the 'delete' program. Using delete will mark a file for removal by renaming "filename" to ".#filename". An automatic system will remove these "marked for deletion"
files three days later.
If you always want 'rm' to do this for you, put the above command into a file in your home directory called '.cshrc.mine' (create it, if you don't already have one).
For more information about 'delete', see the man pages for delete, undelete, expunge, purge, and lsdel. For example, to see the man page for delete, type:
man delete
Also see the stock answer for delete or ask a consultant for more information.
Athena regularly backs up files to magnetic tape. This is to allow file restoration in case of a system crash – not to allow users to recover files they have accidentally deleted. However, if a file is accidentally lost in an isolated incident and its recovery is a very serious matter (such as a thesis or sponsored project), Athena Operations may be able to restore the file from a backup tape. There is no guarantee. Send mail to afsreq@mit.edu, containing the name of the file(s) you want restored, as well as the last date that you know for sure that the files were in your home directory. Recovering data from tape is time consuming, and it may take several working days to process your request.
If you do submit a request, be sure to check your mail daily – restored files are only kept on the system for a few days before they get deleted again.