Re: Copying tar archives/tarballs to tape



Ben Tisdall wrote:
Stephen Patterson wrote:
On Tue, 23 May 2006 07:54:35 GMT, Ben Tisdall wrote:
Bit of a tape noob, need to copy some big tarballs from disk to tape
for someone.

Sure, but it seemed a better idea to get the data on tape as if I'd done
tar cvf /dev/nst0 mybigdirectory

You may want to play about with the block size arguments in tar to find
something more suitable for your drive. Some tape drives, when written to in
the 'wrong' block size, can be picky and/or extremely slow, especially QIC tapes
which get hopelessly slow if they have to keep stopping and starting.

The default block size for tar is 20 x 512 = 10240. Some tape drives leave a
large gape between blocks, therefore bigger blocks = fewer gaps = more capacity.
Some apply error correction only on a per-block basis, so larger blocks = less
error correction available in relation to amount of data = more susceptibility
to errors. This does not apply to all tapes.

Most tar implementations can pipe through gzip, so you can use the 'z' (or 'j'
for bzip2) flag when writing to tape, but bear in mind that compression uses CPU
time, which slows down the flow of data to the tape, and may cause the tape
drive to keep stopping and starting (and hence get _really_ slow). In such
cases, changing block sizes, and/or piping the output of tar through some sort
of buffering program.

In answer to your original question though, you are looking for dd (Data Dump).

Simple case:
dd if=<input file> of=<output file>

In your case <output file> is /dev/nst0

In addition, you probably want to specify a block size. Tar's default is 20 x
512 bytes = 10240. To use that, specify bs=10240
e.g.

dd if=myarchive.tar.gz of=/dev/nst0 bs=10240

To append to an existing tape, rather than overwrite it at the start, use
mt -f /dev/nst0 seod
to wind forward to the current end-of-data. To rewind and eject, use
mt -f /dev/nst0 offline
(Never a good idea to eject a QIC tape without rewinding it. Definitely a good
idea to retention it too, with mt -f /dev/nst0 reten)

If the target system does not have GNU tar, or a really old version that does
not support it, you can always use dd in reverse to recover the file from the
tape, gunzip/bunzip2 it, and then use tar to unpack it from disk.

Tapes are fun. Anyone who put the system pagefile on the TU58 drive on their
VAX will agree. (For various values of fun)

Jim
.



Relevant Pages

  • Re: 3B1 Floppy backup advice
    ... 60MB QIC drives on the other platforms. ... requires care and studies of the tape path on a still good tape. ... Yes -- but the directory structure and the filenames might be ... So -- for a non-unix system, it would be better to pipe the tar ...
    (comp.sys.3b1)
  • RE: redhat-list Digest, Vol 27, Issue 26
    ... The reason I was tarring a tar file to the tape I didn't want to backup a whole file system just to test the tape drive. ... I take that same tape and try to read it on the tape drive that is connected to the linux machine and it doesn't work. ... echo command as in windows ...
    (RedHat)
  • Re: problem with restore
    ... can tar be used to backup files on a machine with remote tape drive..?? ... the '-' on the tar command makes the 'f' go to stdout. ... Have you tried taking backup using tar utility instead of rdump. ... If you take backup and try restore using tar, ...
    (RedHat)
  • RE: problem with restore
    ... Have you tried taking backup using tar utility instead of rdump. ... If you take backup and try restore using tar, ... Also you can verify the content of tape after backup using ...
    (RedHat)
  • Re: tar backup ok but restore errors w/ scsi dat dds2
    ... > Cleaned the drive with a new cleaning cart and used a new tape. ... > tar: Skipping to next header ... > I have already tried two different tape drives, ... Memory test revealed a memory problem which turned ...
    (Debian-User)