| Computer Center

Recover afs data

Computer Center

Recover afs data

1. General information
   1.1 Recover of complete volumes
   1.2 Recover of individual files or directories
   1.3 Display of available backups of a file
2. The recover command
   2.1 How to copy files from ~/Recover to their original place
   2.2 On which AFS volume were the lost data stored ?

1. General information 

Data contained in AFS are grouped in volumes. Backup is done for whole volumes depending on the volume name. Backups are kept for at least 6 months. The following rules do apply:

To recover data in AFS space two modes of operation do exist:

recover of complete volumes
recover of an individual file or directory (usually faster)

The main differences are the speed of the recovery and the location where the recovered data are stored.

1.1 Recover of complete volumes 

Example: Recovery of the contents of volume g.project.data as of 2017/08/01 23:59 or before is done by

arcx recover 2017/08/01 g.project.data

The second argument to the recover procedure is interpreted as a volume name only if the volume was already backed up at least once. Otherwise the argument is taken as a file name (see below).

When requesting the recovery of a volume, a new volume with an appended .Rec to the name is created. This volume is mounted at ~/Recover in your home directory and does not count towards your AFS quota. The volume and mount point are deleted automatically when they are older than 48 hours.

If the volume to be recovered belongs to a project, the volume will count towards the project quota, other volumes (like user volumes) do not have any effect on quota calculation.

While a user can recover arbitrary volumes, access to the data is given only if the original access control lists at the time of the backup are permitting it.

1.2 Recover of individual files or directories 

Example: Recovery of the contents of file ~/.zshrc as of 2017/08/01 23:59 or before is done by

arcx recover 2017/08/01 ~/.zshrc

The recovered file is copied to its original location. If there exists already a file with the same name, .R is appended to the file name (repeatedly, until the file name is unique). A user can recover individual files or directories only if the access control lists (read and lookup rights) do allow that. As the file to be restored will go into an existing AFS volume, the quota of that volume does matter, therefore enough space should be available in the volume.

When recovering a directory subdirectories of a directory are not recovered i.e. the recovery is not recursive

If a relative path is given it is assumed that this is relative to the current directory. Therefore the current working directory should be in AFS space. If that is not the case then the path is assumed to be relative to the (AFS) home directory.

1.3 Display of available backups of a file 

Example: List all available backups for ~/.zshrc

  arcx recover -n ~/.zshrc

Example: List all available backups from files in directory ~/.ssh

arcx recover -n ~/.ssh

When trying to recover individual files it is sometimes useful to list all available versions of a file beforehand. This can be achieved with option -n. If the spelling of the file name is not known, listing the directory contents is of advantage as well. This option does not actually recover anything, it displays what is available. The output is similar to the ls -l output.

2. The recover command 

%arcx recover -h
Usage: recover [-h] [-n] [-d|-v] [YYYY/MM/DD] volume
       recover [-h] [-n] [-d|-v] [YYYY/MM/DD] file_or_dir

     recover an AFS volume from backup with a date before YYYY/MM/DD 23:59
     (also YYYY-MM-DD or YYYYMMDD) or recover a single file or directory.
     If a volume is restored then the volume will be mounted in the callers
     home directory (mount point: ~/Recover).

     -d        show detailed debugging information
     -h        show this help
     -n        do not recover anything, show available file versions
     -v        be more verbose, show existing backup file names

     YYYYMMDD date for recovery (backup from end of that day).
     volume   AFS volume name to be recovered. Default is users home dir volume
     file     If given, the volume will not be recovered but only the file
              or dir will be extracted. Existing files will not be overwritten,
              .R is appended to the name instead until the name is unique.
              AFS directory permissions are respected when trying to recover
              a file, therefore the operation may fail due to the access rights

2.1 How to copy files from ~/Recover to their original place 

to copy whole directories please use
cp -a ~/Recover/mydir ~

check the a(ccess) c(ontrol) l(ists) afterwards:
fs la ~/mydir
fs la ~/Recover/mydir

and change them if needed.
eg.: fs setacl -dir ~/mydir -acl system:anyuser none

2.2 On which AFS volume were the lost data stored ? 

the command fs lq <full path> returns the volume name

% fs lq ~/mail
Volume Name                          ...   ...
user.looser                          ...   ...

% fs lq /afs/.ifh.de/group/mygroup/myproject
Volume Name                          ...   ...
g.mygroup.vol10                      ...   ...