tar write err


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers tar write err
# 1  
Old 05-17-2002
tar write err

This isn't causing me a problem, but it is puzzling (& slightly worrying) me.

If I use tar to copy to a tape & the tape is write protected, I only get the message 'tar: tape write err' if there are a few files to copy.

eg. # tar cvf /dev/rStp4 /usr/data
will produce the messages

/usr/data/file1
/usr/data/file2
/usr/data/file3
/usr/data/file4
/usr/data/file5
tar: tape write error


however # tar cvf /dev/rStp4 temp
produces the message

a temp 1 tape block

and no error message.

Any ideas?

This is on SCO openserver 5
# 2  
Old 05-17-2002
I don't know the answer to your question. But I will make an educated guess.

My guess is that tar is using fopen(), setvbuf(), fwrite(), and fclose() (or a very similiar set of functions) to write to the tape device.

These routines implement buffered I/O. When you call fwrite() your data is shoved into the buffer. Only if the buffer fills will a write actually occur. And fclose() will write any data left in the buffer on the way out.

Programmers will usually check the return code from a routine like fwrite(). But only a first class programmer will bother to check the return code from fclose().

So if you write enough stuff to the tape that a fwrite() needs to flush the buffer, tar detects the problem and displays an error message. But if you don't fill even one block, tar does not notice that its fclose() failed.

Remember this is only a guess. But I have seen this mistake hundreds of times.
# 3  
Old 05-17-2002
Thanks, I thought it might be something to do with a buffer filling

It still concerns me that a backup (albeit a small one) done using tar would not give an error message. I don't think there is any way round that though since the error code ($?) is set to 0 too.
# 4  
Old 05-17-2002
After the backup finishes, do a table of contents list on it. And extract the last file. If both of those operations work you have a fairly strong indication that the tape is good.
# 5  
Old 05-17-2002
Yes, I suppose so or save a small file with a number (that is incremented on each backup) in it & extract that back to check. That way I can be sure that I'm not just copying back a file with the same name from an old backup.

Still, this isn't actually effecting me, all our backups are too big for this to apply. It just seemed odd.

Thanks Perderabo.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

I/O error Err#5 EIO

Hi gurus, My Solaris version is Solaris 10 1/06 s10s_u1wos_19a SPARC Im getting I/O error while trying to ls -l a directory in Solaris SPARC box the truss output from server is attached below truss -fall -vall -wall -rall ls -la 12278/1: acl("./dat", GETACLCNT, 0,... (3 Replies)
Discussion started by: Solaris_Begin
3 Replies

2. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

3. UNIX for Advanced & Expert Users

tar: write error: unexpected EOF

tar: write error: unexpected EOF I usually encounter this when I'm doing backup to Dat72 tape. Here's the command gzip all files in a directory then tar cvfp /dev/rmt/0n files. Not all files are copied. Any things I should look at? Directory size? ---------- Post updated at 05:20 PM... (1 Reply)
Discussion started by: lhareigh890
1 Replies

4. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

5. Shell Programming and Scripting

To write a shell script which groups files with certain pattern, create a tar and zip

Hi Guru's, I have to write a shell script which groups file names based upon the certain matching string pattern, then creates the Tar file for that particular group of files and then zips the Tar file created for the respective group of files. For example, In the given directory these files... (3 Replies)
Discussion started by: rahu_sg
3 Replies

6. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

7. Shell Programming and Scripting

how to write script in tar

i have the script.in this script comprees formatlike tar and insert to another directory and another sever.and how to write this process in script . iam new for unix how to do this process. please helpmea naveen.g (1 Reply)
Discussion started by: naveeng.81
1 Replies

8. UNIX for Dummies Questions & Answers

tar: write error: unexpected EOF

I am taring to disk and get this message: tar: write error: unexpected EOF This message is normally associated with tape devices, not disk. Here is the syntax: tar -cf <tarfilename> /dir Have you seen this message on disk tars? (4 Replies)
Discussion started by: jabe
4 Replies

9. Shell Programming and Scripting

tar: write error: unexpected EOF

Hi friends, I am using Sun Solaris 5.9. I want to take backup of 3 folders which are 50 GB in size totally using tar command on tapes. I am having DAT 72 tape. After initiating tar command (tar -cvf /dev/rmt/0n /tmp/dir1/ /tmp/dir2/ /tmp/dir3/), tarring is stopped after 10 hrs (approx) and i am... (7 Replies)
Discussion started by: vijayakumar.pc
7 Replies

10. UNIX for Dummies Questions & Answers

tar: write error unexpected end of file

Hi, I have attempted to backup some database files on my company's Solaris machine about 3 times now. Each time that I attempt the backup, about 6 files are evident on the dat tape when I do read of the media and then I see the dreaded "tar: write error unexpected EOF" message. Each time that I... (2 Replies)
Discussion started by: robyn
2 Replies
Login or Register to Ask a Question