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:
- Run tkrestore at the shell command line. This will pop up a window like the one here:
- Select your username in the centre panel and click on Read Indices. This can take a while if there are a lot of files in your account.
- The available files and directories are listed in the left panel.
- Entries from incremental backups are highlighted and flagged with an 'i'.
- Entries from full backups are flagged with an 'f'. (see the next section for the difference between full and incremental backups)
- Files with multiple versions availiable are flagged with a '+'. (the latest version will be shown by default)
- Subdirectories are also flagged with '+', along with 'DIR in the file-size field.
- Double-click '+' lists to expand the contents; double-click again to collapse them again.
- 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. Eg: /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.
- Frequency: Full backups are taken monthly of every home directory. Every file is copied onto archival tape, regardless of how new or old it is.
- Restoration time: 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:
- Online Storage: 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;
- Tape Storage: 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;
- Off Site Storage: 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.
- Notification: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.
- Directory Restoration: You can restore the entire contents of a directory (including its subdirectories) from full backups by selecting and adding the directory in question to the list of files/directories you wish to restore. However, only constituant files smaller than 2Gb in size will be restored when restoring a directory and its contents, as the underlying archive cannot natively accomodate larger files.
- Large File Restoration: If you wish to restore files larger than 2Gb in size, then they need to be specifically selected. Such large files are archived individually, and will not be automatically restored if an ancestor directory (nominally containing the large file) is selected to be restored.
- Frequency:Incremental backups are taken nightly but only of any file that has changed or been created since the last incremental backup was taken.
- Storage: Incremental backup archives are stored on online disk storage. As this is limited, there is a quota imposed on each user limiting the total amount of new or changed files belonging to that user that may be copied into storage each night.
- Restoration Time: Incremental backups are restored immediately from online disk archives as soon as you click Restore.
- Directory Restoration: You cannot restore entire directories from incremental backups as you can from full backups. You must select each file individually from incremental backups that you wish to restore.
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.