Sponsored Content
Full Discussion: tar write err
Top Forums UNIX for Dummies Questions & Answers tar write err Post 21508 by Perderabo on Friday 17th of May 2002 08:04:21 AM
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.
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
STREAM_SOCKET_PAIR(3)							 1						     STREAM_SOCKET_PAIR(3)

stream_socket_pair - Creates a pair of connected, indistinguishable socket streams

SYNOPSIS
array stream_socket_pair (int $domain, int $type, int $protocol) DESCRIPTION
stream_socket_pair(3) creates a pair of connected, indistinguishable socket streams. This function is commonly used in IPC (Inter-Process Communication). PARAMETERS
o $domain - The protocol family to be used: STREAM_PF_INET, STREAM_PF_INET6 or STREAM_PF_UNIX o $type - The type of communication to be used: STREAM_SOCK_DGRAM, STREAM_SOCK_RAW, STREAM_SOCK_RDM, STREAM_SOCK_SEQPACKET or STREAM_SOCK_STREAM o $protocol - The protocol to be used: STREAM_IPPROTO_ICMP, STREAM_IPPROTO_IP, STREAM_IPPROTO_RAW, STREAM_IPPROTO_TCP or STREAM_IPPROTO_UDP Note Please consult the Streams constant list for further details on each constant. RETURN VALUES
Returns an array with the two socket resources on success, or FALSE on failure. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | This function is now available on Windows plat- | | | forms. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 A stream_socket_pair(3) example This example shows the basic usage of stream_socket_pair(3) in Inter-Process Comunication. <?php $sockets = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP); $pid = pcntl_fork(); if ($pid == -1) { die('could not fork'); } else if ($pid) { /* parent */ fclose($sockets[0]); fwrite($sockets[1], "child PID: $pid "); echo fgets($sockets[1]); fclose($sockets[1]); } else { /* child */ fclose($sockets[1]); fwrite($sockets[0], "message from child "); echo fgets($sockets[0]); fclose($sockets[0]); } ?> The above example will output something similar to: child PID: 1378 message from child PHP Documentation Group STREAM_SOCKET_PAIR(3)
All times are GMT -4. The time now is 04:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy