How to restore data from a vtape using the dd command

This article is for Amanda Enterprise (AE)

Caution: failure to read these instructions completely and carefully may result in data loss.

The following steps may be used any time it is desired to use system tools to extract a backup image such as when a backup set’s configuration and index files are no longer available. It is of note that this should only be considered as a last resort. In most cases, other Amanda applications (e.g. amrecover, amrestore, amfetchdump, etc.) should be favored above using system tools.

Legacy (vtape):

  1. To restore backups created during a specific point in time, use any available backup report in email or as saved in ZMC on the Report | summary page to identify which tape was used during the backup as listed in the Usage By Tape section.
  2. On the Amanda server, go to the directory where the vtapes for the backup set are saved. This is in a directory named after the backup set in /var/lib/amanda/vtapes/ by default. It can be seen in ZMC on the Backup | where page when available. For instance:cd /var/lib/amanda/vtapes/Daily
  3. Each “slot” directory in this vtape directory represents a different tape. The label or the tape in that “slot” can be seen as the name of the file in the “slot” directory starting with 5 zeroes, for example, “00000.Daily-009”. Change into the desired “slot” directory, for example:cd slot9
  4. Filenames of backups on that tape or “slot” directory are named after the host and directory/database/application of which it is a backup. The extension indicates the level of a backup: “0” for full backup and “1” or greater for an incremental backup. Reading the header of the desired backup file will indicate what the file is a backup of, when it was created, with what application it was made, whether compression and/or encryption was used, etc. It also shows at the very end of the output how to restore the backup using system tools and Amanda APIs. The header can be read by using the following command by reading only the first block of the backup file where file is the filename of the backup:dd if=file bs=32k count=1 For example: dd if=00002.rhel7-64._etc.1 bs=32k count=1

Change directories to a temporary directory that is large enough for the restored data and use the restore command mentioned at the end of the backup header to restore the backup. Specify the backup file within the dd command as an absolute path. Restoring to a temporary directory is recommended as restored files will overwrite files of the same name in the current working directory and, in some cases, will remove any files and directories not found in the backup.

Simplified Disk (sdisk):

The newer sdisk option is fairly similar to Legacy vtape. However, sdisk does have some major changes. There are no longer any “virtual slots.� Instead, the sdisk backup images are kept together in a single directory. The new format also includes both a dump header and an Amanda label, each are 32k in size.

  1. Use previous amreport output to identify which tape was used during the backup as listed in the “Usage By Tape” section.
  2. On the Amanda server, go to the directory where the sdisk backup images are saved. This is in a directory named after the backup set in /var/lib/amanda/disk/ by default. It can be found in ZMC on the Backup | where page when available. For instance:cd /var/lib/amanda/disk/Daily
  3. Reading the header of the desired backup file will indicate what the file is a backup of, when it was created, with what application it was made, whether compression and/or encryption was used, etc. It also shows at the very end of the output how to restore the backup using system tools and Amanda APIs. The header can be read by using the following command by reading the first and second blocks of the backup file where file is the filename of the backup: dd if=file bs=32k count=2 For example: dd if=etc-AA-rhel7_64-0000000002 bs=32k count=2

As is true with Legacy vtape, when actually restoring you will want to change directories to a temporary location with enough space to accommodate the restore. If you restore to the original location, you will overwrite data and any files or directories not in the backup image will be removed.

Windows Disk Images

If the backup is Windows data, the command stated in the header restores a zip file. The header can be accessed using the same commands above depending on whether the backup uses vtape or sdisk. This zip file can either be copied to a Windows machine where PKZip or equivalent zip utility can be used to extract the data. The unzip UNIX command can also be used to extract data on the Amanda server. As an example:

# for vtape
dd if=00001.WindowsClient.C__Users_Public.0 bs=32k count=1

# for sdisk
dd if=public-AA-WindowsClient-0000000001 bs=32k count=2

Powered by BetterDocs

Leave a Reply