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


  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:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 13 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
13 comments… add one
  • Sajjad Mar 20, 2007 @ 10:48

    dear Sir/madam,

    I am facing problem whihle writing cammand in Unix to take backup on tape device. sir/madan kindly help me in quick time. i am trying this command on SCo Unix System V/386 release 3.2

    # tar cvfb /dev/rct0 20 ./usr/shares backup taken on: 20/03/2007

    please tell me eather my command is correct and also help if it is not correct


    Sajjad Ahmad

  • Omer Apr 17, 2007 @ 6:01

    Hi ,
    I’m taking backup on a tape through an automated script but lately i’ve been getting an error

    /dev/nst0: Input/output error

    How do i check this error in advance so that a mail could be fired ??
    Can u please give me the commands ??

  • Syed Faisal Jafri Feb 8, 2008 @ 12:57

    i want to take backup daily but i don’t know how to do.. any one can help me. im using linux redhat enterprise ws4 u5.

  • Ashraf Jun 10, 2008 @ 6:09

    i am taking backup on a tape (HP DDS-2 data catridge).the command like “tar cvf /dev/st0 test” is using for copying & “tar rvf /dev/st0 test1” using append the file.but rvf command not working … why?

  • A. Sheri Oct 24, 2008 @ 15:19

    Verify tar command tape restore under Linux or UNIX

    Good Day,

    I want to to restore the backup (tape) to save it on a DVD, could you please be so kind to assist me.

    I thank you for your kind assistance.


  • aparna Feb 26, 2009 @ 10:15

    how to take backup in linux on hard disk
    is it necessary to create new partition

  • manasa kallianpur Aug 18, 2009 @ 7:21

    how to take backup of a drive on tape in unix

    • UnixAmature Sep 6, 2010 @ 9:49

      you can try the tar command.

      # tar -cvf /directory_name /dev/rmt/0m
      /dev/rmt/0m is the tape drive path. please check the tape drive first using the command–
      # ioscan -fnCtape
      tape drive path may be /dev/rmt/0m or /dev/rmt/0mn or /dev/rmt/1m or 1mn. check it in ur machine

  • arun Apr 2, 2010 @ 15:09

    dear sir/madam

    i want to take backup daily but i don’t know how to do.. any one can help me. im using linux redhat enterprise 4 & 5. And i want to know how to write these back up in shell scripts

  • prince gupta Feb 26, 2011 @ 9:09

    Let Say if you want to take backup of /etc dir.

    # tar -cvf etcbackup.tar /etc
    It will back up of your /etc dir. in root home dir. in tar format.

  • zimmy Jul 11, 2011 @ 10:29

    hi all could u pls help

    i need to take back using tar bt except last two days….means example from 4th july to 8th july

    pls reply nd explain steps


  • tin Sep 12, 2011 @ 8:22

    hi All
    in linux i istalled ubax_cbmr, in that cbmr how to take backup ? what is the command?
    its connected with tsm.

  • B.V.YADHUKULESHA Nov 9, 2014 @ 11:01


    tar xv8 /usr1/wage/kaimal

    kaimal is directory

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum