LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 04-19-2007, 01:37 PM   #1
helpmhost
Member
 
Registered: Oct 2006
Posts: 43

Rep: Reputation: 15
verify tape contents


Hi,

Is there a way I can compare a tar on a tape with a tar on a hard drive?

At the moment, my backup, copies (using dd) a large tar file to tape on a daily basis. I would like my script to verify that the tar file was written to tape properly.

Would either of the following work:

diff mytar.tar /dev/nst0
OR
compare the md5 of mytar.tar and of /dev/nst0
OR is there another way of doing this?

Thanks.
 
Old 04-19-2007, 02:53 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
You could try running cksum on each to see if they are the same.
 
Old 04-20-2007, 01:14 PM   #3
helpmhost
Member
 
Registered: Oct 2006
Posts: 43

Original Poster
Rep: Reputation: 15
Thanks for the reply.

When I try to run md5sum or cksum against /dev/nst0, I get:

cksum: /dev/nst0: Cannot allocate memory

Is there a way to run either of these commands to verify a file on tape (without extracting the file(s))?

Or is there some other way to verify the contents?

Thanks.
 
Old 04-20-2007, 01:26 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
/dev/nst0 would be the no rewind device (as opposed to /dev/st0 which would automatically rewind).

If you just backed up using /dev/nst0 it means the you're at the end of the backup. You'd need to move the tape to the start of the backup to try your cksum.

Have a look at the "mt" man page:
man mt

If you're putting multiple backups on the tape you'll have to use the mt options to backup to previous record or file. If you're only putting in one backup on each tape you can just do a rewind on the tape and start the cksum from the beginning of the tape.

Doing a "tar tvf" would list the files backed up rather than extracting them from the tape. It would still have to read the tape to get the list though. It would save on I/O however because it wouldn't actually transfer the files onto the disk.

The caveat about use of /dev/nst0 still applies though. If you did "tar tvf /dev/nst0" after a backup it wouldn't show you anything because it would try to do the list from where it is now (end of last backup) rather than the start of the tape or the start of the last backup.
 
Old 04-20-2007, 04:07 PM   #5
helpmhost
Member
 
Registered: Oct 2006
Posts: 43

Original Poster
Rep: Reputation: 15
I already know about /dev/nst0 and /dev/st0 as well as mt. I am not asking for help regarding using a tape drive.

What I want to know if how to verify that the backups were properly written. The way I see it, the best would be the ability to compare the tar files or to get 2 MD5s and compare those. However, I am not able to get an MD% or a checksum from the tar on tape.

When I position the tape at the beginning of tape (and file) and run either md5sum or cksum, I get the following error:
md5sum: /dev/nst0: Cannot allocate memory

All this tells me is that the md5sum and cksum commands don't know how to handle tapes. They don't know where a file ends/begins etc...

So I would just like to know if there is some way (a trick maybe) to get this working. Or if there is an implementation of a checksum type utility that can either calculate a hash or a checksum of a tar on tape.

Thanks.
 
Old 01-02-2008, 01:18 PM   #6
petcherd
Member
 
Registered: Dec 2006
Location: Portland, OR - USA
Distribution: Formerly Slackware; now RH, SuSE, Debian/Ubuntu, & Asianux
Posts: 55

Rep: Reputation: 15
Sorry for the late reply; I was searching for another topic and I saw that this thread was semi-adequately answered...


mt rewind
cd /
tar -dvf /dev/nst0

should verify the contents of the tape against the files on your disk. You can add more complicated options for handling multi-volume tapes, sparse files or other features, but the --diff option is your basic mechanism for checking the validity of a new tape's contents.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading the Contents of a Dump Tape kaplan71 Linux - General 2 11-08-2006 02:34 PM
list contents of directory without listing contents baddah Linux - Newbie 2 06-12-2006 04:02 AM
Using a DDS5 tape drive to restore from a DDS3 backup tape. AndrewCAtWayofthebit Linux - Hardware 1 05-14-2006 09:15 AM
Verify a CD-ROM VorlonInfoTech Linux - Hardware 1 03-07-2005 02:37 AM
Tape incremental backup to different tape tungaw2001 Linux - Software 0 08-13-2003 09:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 11:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration