This site requires JavaScript to be enabled
Knowledge > General > Accidently deleted a file from my AFS home directory
Accidently deleted a file from my AFS home directory
Article: REM-KB0001332 Published: 2015-12-03 Last modified: 2018-05-01

Problem:

I accidently removed a file from my home directory, and I need it back.
How can I get a backup copy restored?

Solution:

All user volumes (home directories) are backed up on a regular basis.
Part of the backup process is the generation of backup volumes, or
online backup copies. In general, backup volumes are created every
morning shortly after midnight, and they exist, unaltered, until the
next time a backup volume is created. One result of this is that users
may now restore their own accidentally deleted files from their backup
volumes in most situations.

Restoring deleted files from a backup volume can be done in most cases.
These cases will meet the following criteria:

   The most recent backup volume was made at some point when the
   file in question existed. This means that if you delete a file
   that you just created, chances are, it hasn't made it to a
   backup yet.

   The user must recognize that he or she wants that file restored
   before the next backup volume is made (generally in the early
   morning hours.) 

If your situation meets these criteria, then you should be able to
recover your files by yourself, or with the help of a consultant or
operator. If you do not meet these criteria, or you are unsuccessful,
your next step of action should be to contact the Help Desk
and request a restore from the tape backup.

Please note the following when requesting a restore from tape:

   Restoring files from a backup tape is a labor intensive and time
   consuming process.  For this reason, unfortunately, in most cases we
   can only perform up to two restores from tape to help retrieve your
   lost files.  So please request your restore date(s) carefully.
 
   Backups on each day are made from a snapshot of your files as they
   existed on or around midnight of that day.  Requesting a restore
   for 1/14/08 (a Wednesday), for example, will give you access to your
   files as they existed when you quit working on Tuesday.

Restoring files from your AFS backup volume:

**NOTE**

Before getting started, regardless of what operating system you are on, 
you will need to get to a unity% or eos% prompt.  Brief directions for our 
systems are listed here:

Unix/Linux: Open a new terminal window or use default terminal window.

Windows or Macintosh: Follow the instructions on...

   https://oit.ncsu.edu/campus-it/web-services/unity-file-space/unix-or-linux-command-line/

Every instruction listed below that is labeled a "command" needs to be 
entered at this unity% or eos% prompt.

Step One: Getting Started

You will need to know some things before you get started. 

   - The name of the file(s) you want restored
   - The location of the file(s) you want restored
   - The name of your volume

You can determine this by using the command:

   fs examine ~/

It will output something like: 

   Volume status for vid = 537008297 named users.wufpak
   Current disk quota is 20000
   Current blocks used are 10593
   The partition has 214269 blocks available out of 1872775

We're interested in the last bit of the first line. The name of this
volume is users.wufpak

- Where (in which cell) your volume lives 
You can determine this by using the command:

   fs whichcell ~/

It will output something like: 

   File /ncsu/wufpak lives in cell 'unity.ncsu.edu'

- A mountpoint directory 
This can be anything you want; to make life easier and less confusing,
this should be a directory or file that does not already exist. 

Step Two: Go Home

Use the cd command with no arguments to move to your home directory. 

   cd 

Make sure you do not have any directories named backup already.  
To do this type 

    ls
 
If you have a directory already named backup you may need to move it.

 

Step Three: Mount Your Backup Volume

First, you need to tell your computer where to access your backup
volume. This is done by a process called mounting. The general form
of the command to mount your backup volume is:

   fs mkmount -dir mountpoint directory -vol volume.backup -cell cell

The full command for a real user might look like:

   fs mkmount -dir backup -vol users.wufpak.backup -cell unity.ncsu.edu 
or
   fs mkmount -dir backup -vol users.w.wolfpack.backup -cell eos.ncsu.edu 

 

Generally, If you are not in engineering and you want to make a backup.  
You can use this command 

fs mkmount -dir backup -vol users.yourunityid.backup -cell unity.ncsu.edu

Obviously- You need to replace yourunityid with your id in the command.

Step Four: Retreive Your Files

Now that you've mounted your backup volume, use the cd command to go to
that directory. cd ~/mountpoint where mountpoint is the mountpoint
directory from above. You are now in the "root" of your home directory
as it was at the time the backup volume was made. Use the cd command to
change to the directory in which the file you wish to restore was in.
Then use the cp command to copy that file back to your real home
directory:

   cp restore.html ~/

Repeat Step Four for each file you wish to restore

If you have problems getting to your backup volume, with errors such as
"Connection Timed Out" or "Volume not Available", this may be due to the
fact that your volume was moved, and no online backup is available. In
this case, you will have to request a backup restore from tape, which
will take a little longer. For more information on tape restores, see:

   ServiceNow Knowledge Base Article: REM-KB2167


Expand/Collapse Comments
:     
Was this helpful?
YesYesNoNo
Rate this article