Skip to content

Restoring files in the recycle bin

The tool cta-restore-deleted-files can restore deleted files from cta that match the given criteria. The tool can recover files that have been deleted by a user, by EOS or by an operator using cta-admin tf rm. This tool should only be used as a last resort.

There are tree scenarios for disk file recovery:

  1. The file has been deleted in the EOS namespace and in the CTA catalogue This happens in the case of a normal file removal from the user (eos rm). The strategy is to reinject the file metadata in EOS and restore the file entry in the cta catalogue (with a new diskFileId).

  2. The file has been deleted in the CTA catalogue but the EOS diskFileId remains the same. This can happen during a disk draining. The file is kept in the EOS namespace but the entry is removed from the Catalogue. The strategy is to just restore the CTA Catalogue entry.

  3. The file has been deleted in the CTA catalogue but the EOS diskFileId changed. This happens during the conversion of a file from a space to another. The strategy is to recover the CTA Catalogue entry and update the diskFileId to the one that corresponds to its EOS entry.

Since the tool restore the files in both the EOS and CTA namespaces, there is no atomicity guarantee. Specifically, a file may be restored in the EOS namespace but the same restoration may fail in the CTA catalogue.

The tool comunicates with the EOS instances using grpc. As such, it requires an access token to these instances with write permissions. It uses the standard cta configuration files /etc/cta/cta-cli.conf and /etc/cta-frontend-xrootd.conf. The key tab path is read from the cta.ns.config entry in the frontend configuration file. (TODO: maybe we should add a command line option to choose this file).

Assuming the daemon user of an eos instance already has root priviledged, you can create an access key with the following eos commands

eos vid set map -grpc key:<key> vuid:2 vgid:2
eos -r 0 0 vid add gateway <domain name> grpc

This key must be removed from the eos instance once the restoring operation has finished.