Restoring deleted files
There is no 'undelete' command in Linux. If you need to get a file back that you've accidentally deleted or overwritten, you need to restore it from backups.
The easiest way to restore from backups at CSE is to use the command tkrestore on the lab machines or login servers.
tkrestore is a graphical application, so if you're running it over PuTTY/SSH, you'll need to set up an X server on your computer.
Alternatively you can use vLab on your computer.
To get started, select your username in the centre panel and click Read Indices. This can take a while if there are a lot of files in your account.
- The files and directories that can be restored are listed in the left panel.
- Files are highlighted and flagged with an 'i' if they come from incremental backups, while they are not highlighted and are flagged with an 'f' if they come from full backups. (see the next section for the difference between full and incremental backups)
- Files are flagged with a '+' if there are a number of copies available from different backup dates and/or sources (full/incremental) between the start and end dates. Double clicking on the file/directory will toggle between displaying all alternative copies and their dates (each flagged with a '-'), and displaying the the most recent copy (flagged with a '+').
- Directories are indicated by the DIR tag, and by default they have a '+' after their name, and their contents are not displayed. Double clicking on the directory will cause the directory's contents to be listed below it, indented by a couple of spaces. Double clicking on the directory again will cause the directory's contents to be unlisted once more.
- Select the files/directories in the left panel that you want to restore, and click Add to add them to the list of files to be restored, shown in the right-hand panel.
- Click Restore to restore your files.
- The files will be restored into /home/YourUserName/Restored_Backup/source-date, where YourUsername is your username, source is either i or f depending on the backup source, and date is the date on which the backup was taken.
- For instance: /home/jbc/Restored_Backup/i-06.05.17/
- For more detailed instructions on how to use tkrestore, click on the 'Help' button in the lower right of the tkrestore window
Full vs Incremental backups
tkrestore can restore files from full backups and from nightly/weekly incremental backups.
- Full backups are taken monthly of every home directory. Every file is copied onto archival tape, regardless of how new or old it is.
- It can take anything from a couple of minutes, to a couple of working days to restore files from full backups. This depends on where the desired archive(s) reside that contains the files to be restored:
- Every user's last archive is usually kept online on disk. Any files coming from these most recent online disk archives can be restored immediately;
- Every user's archive is also written to tapes which are kept indefinitely. If the tape containing the desired archive is already loaded in the tape library, then the desired tape will be automatically loaded into a tape drive (every 15 minutes) and the files restored from the tape archive;
- If the desired tape is stored offline (ie: not loaded in the tape library), then a human operator would need to be informed, who would then need to load the desired tape into the tape library before the files could be restored as per the previous step. This may take a day or so.
- If your files are restored immediately from online archives, then tkrestore will inform you of this, otherwise you will receive an email after the backup system records your request, and subsequently attempts to restore your files from tape.
- You can restore the contents of an entire directory (and its subdirectories) from full backups by selecting and adding the directory in question to the list of files you wish to restore.
- Incremental backups are taken nightly of any file that has changed or been created since the last incremental backup was taken.
- Disk space for incremental backups is limited, and some of your new or changed files may not be copied if you have exceeded your incremental backup quota for that night.
- Incremental backups can be restored immediately from online disk archives as soon as you click Add.
- You cannot restore entire directories from incremental backups. You must select each file individually that you wish to restore from incremental backups.
If you need help
If you're having any problems with any of this, contact System Support - we're more than happy to give you a hand.