How to: HP-UX UNIX Backup and Recover Data to Tape Device

www.lau‮rutt‬i.com
How to: HP-UX UNIX Backup and Recover Data to Tape Device

To backup and recover data on an HP-UX Unix system using a tape device, you can use the "tar" command and the "mt" command.

Here's the general procedure for backing up data to a tape device:

  1. Connect the tape device to your system and make sure it is recognized by the operating system. You can use the "mt -f /dev/rmt/X status" command to check the status of the tape device, where X is the device number (e.g., "0" for "/dev/rmt/0").

  2. Create a list of files and directories you want to backup. You can use the "find" command to generate the list, for example:

find /path/to/directory -type f > filelist.txt

This will create a text file called "filelist.txt" that contains the names of all files in the "/path/to/directory" directory.

  1. Use the "tar" command to create an archive of the files and write it to the tape device. For example:
tar -cvf /dev/rmt/X -T filelist.txt

Replace X with the device number of the tape device. The "c" option tells "tar" to create a new archive, the "v" option enables verbose output, and the "f" option specifies the output file (in this case, the tape device). The "-T" option specifies the list of files to include in the archive.

  1. When the backup is complete, use the "mt" command to rewind the tape and eject it from the drive. For example:
mt -f /dev/rmt/X rewind
mt -f /dev/rmt/X eject

To recover data from a tape device, you can use the following procedure:

  1. Connect the tape device to your system and make sure it is recognized by the operating system.

  2. Use the "mt" command to position the tape at the beginning of the archive you want to recover. For example:

mt -f /dev/rmt/X rewind
mt -f /dev/rmt/X fsf 1

The "rewind" command moves the tape to the beginning, and the "fsf" command (forward space file) moves the tape to the next file (in this case, the first file).

  1. Use the "tar" command to extract the files from the tape device. For example:
tar -xvf /dev/rmt/X -C /path/to/directory

The "x" option tells "tar" to extract files from the archive, the "v" option enables verbose output, and the "f" option specifies the input file (in this case, the tape device). The "-C" option specifies the directory where the files should be extracted.

  1. When the recovery is complete, use the "mt" command to rewind the tape and eject it from the drive.

Note: The "tar" and "mt" commands are powerful utilities that can be used to perform various tape management tasks. You can refer to the "tar" and "mt" man pages or online documentation for more information about the options and usage of these commands. It is always a good idea to create a backup of your data before attempting to recover it, as recovery operations can sometimes cause data loss.

Created Time:2017-10-29 22:08:41  Author:lautturi