Verify tar command tape backup under Linux or UNIX

I am using the tar command to backup data to tape. How do I verify that tape backup is in a good condition?

The GNU/tar command has -w or --verify option. This option attempt to verify the archive after writing it to tape, use the command as follows to backup data and attempt to verify the archive after writing:

Verify TAR backup with -w and –verify options on GNU/Linux

Type the following command as follows to backup /home/ to /dev/st0 and attempt to verify the archive after writing it to /dev/st0 tape device:
# tar -cvpWlf /dev/st0 /home

Where,

  1. c : Create a new archive of /home
  2. v : Verbose output
  3. p : Ignore umask when extracting files i.e. preserve permissions on files
  4. W : Attempt to verify the archive after writing it
  5. l : Stay in local file system when creating an archive
  6. f : Specify /dev/st0 as tape device (file)
  7. /dev/st0 : Tape device name
  8. /home : Directory to backup

Examples: Tape backup/verify/restore procedures on Unix

First, load your tape cartridge into the tape drive. Log onto server. Backup /home/ to the tape device called /dev/rmt/tps3d4.8500c:
# cd /home/
# tar cvbf 64 /dev/rmt/tps3d4.8500c .

After the backup is complete:

  • Eject the tape
  • Label the tape with the date, the data stored, and the tar command used tar cvbf 64
  • Write-protect the tape
  • Put tape back in the drive and list contents to verify tape can be read:
    # tar tvbf 64 /dev/rmt/tps3d4.8500c

To do restoring a tape backup, run:
# tar xvbf 64 /dev/rmt/tps3d4.8500c

For more information see:

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.