ECN No Name Newsletter: September, 1988

The ECN No Name Newsletter is no longer being published. This is an archived issue.

[previous article] [next article]

RM with ZAP Installed on Sun Workstations

J. Michael Moya

The rm (remove) command is a standard UNIX command designed to completely erase a file from the computer disk. This command was built with the understanding that when a users removed a file, it was no longer wanted. However here at Purdue it was discovered that every once in a while, a user would momentarily disengage fingers from the brain and a useful file would get deleted (it happens to all of us!). Therefore ECN customized the rm command with the /zap directory backup. The other standard option flags for rm remained the same.

The UNIX rm command on all Sun3 servers and clients has now also been customized to supports a /zap directory. If you are not familiar with what /zap is, please read on.

With the /zap directory in place, when you remove a file by typing

                           rm filename

a subdirectory is created within the /zap directory and this subdirectory is named using your user I.D., /zap/userid. Then whenever you remove a file, it is placed there. The idea is that after you remove a file from your current directory, you still have an accessible copy of that file in case you really didn't want to remove it. For example, if I removed the file "test.file" with the following command:

                          rm test.file

While "test.file" disappears from my current directory, it is not completely gone. It now temporarily resides in the directory /zap/moyman (moyman is my user I.D.) This can be verified by typing

                         ls /zap/moyman

In addition, if I want this file back, I can type the following command:

               cp /zap/moyman/test.file  test.file

the same "test.file" that I removed earlier would once again be in my current directory (plus a copy would still remain in /zap/moyman). All files removed with the customized rm are thus "saved" in /zap/userid.

The customized rm command still permits a file to be directly discarded by use of the -f flag. For example, if you typed the following command:

                         rm -f test.file

its gone! It will NOT be in /zap/userid. In addition, any file over 100 blocks in size (no matter what the option) will not be placed in /zap/userid.

If you remove a file that happens to have the same name as a file you removed earlier (i.e. the file name is in /zap/userid already) then the following rule applies. The file most recently removed will carry the plain file name in /zap/userid while the file that WAS in /zap/userid is still there, but will have a number appended to the name indicating it was a previous version.

There are limitations as to how long the removed file will remain in the /zap directory. If there is enough space, it will remain there until 1:15AM. Every morning at that time all directories and files are removed from /zap. The retention of files within /zap is directly related to how much space is in /zap AND how much space is in your directory. When /zap is over 2000 blocks, all files over an hour old are removed to permit the "saving" of new files. If /zap is still larger than 2000 blocks after removing "old" files, then all files are removed (plenty of space then!).

Periodically users will fill their allotted space quota and need to remove files to get within their quota limit. Determining the amount of space you are using can be tricky. If you do a du (disk usage) in your home directory to see how much space you are using, it will not give you "the whole picture". Du will tell you the disk usage of all the files in your directory, BUT IT WONT TELL YOU HOW MUCH SPACE YOUR /ZAP DIRECTORY IS TAKING UP. Currently on Suns, /zap IS part of your file system and IS included in the amount of space you are using when your quota is calculated. So, even though it looks as though you are under quota, you might not be...check your /zap directory. To remove files from /zap remember to use the the -f option. When the new operating system is installed on all Suns (4.0), this will change. /zap will be a separate filing system, not a part of your space (...so be patient).

For those users with a "csh" environment, who NEVER want any files saved in a /zap directory, place the following line in your .cshrc or .login file.

                         alias rm rm -f

A handy command you can set up in your workspace could be one that retrieves a file from /zap for you. For example, if you put the following in your .cshrc file, or just typed it after your unix prompt:

             alias getzap cp /zap/$user/!\* !\*.zap

you could retrieve files from your /zap directory by typing

                         getzap filename

It would copy the file from your /zap directory and put it in your current directory under the name "filename.zap". Of course, you can customize the alias to whatever you wish.


webmaster@ecn.purdue.edu
Last modified: Friday, 31-Oct-97 11:21:11 EST

[HTML Check] HTML