Skip to contentSkip to conversation

SCSI tape corruption problem

DISCUSSION Marc SCHAEFER 3 participants 5 messages Apr 14, 2001 – Apr 15, 2001

lore
Share & tools
lore
#0 lore raw

Now try this:

cd ~archive
mt -f /dev/tapes/tape0 rewind
tar cvf - . | gzip -9 | dd of=/dev/tapes/tape0 bs=32k

and then:

   mt -f /dev/tapes/tape0 rewind
   dd if=/dev/tapes/tape0 bs=32k | gzip -d | tar --compare -v -f -

The above is the proper way to talk to a tape drive through gzip.

PS: if you pre-compress, it can be wise to suppress hardware compression (mt -f /dev/nst0 datcompression 0) and maybe use a big buffer with the buffer command.

#1 lore raw
Quoted 6 lines · Marc SCHAEFER

Now try this:

cd ~archive
mt -f /dev/tapes/tape0 rewind
tar cvf - . | gzip -9 | dd of=/dev/tapes/tape0 bs=32k

Quoted 6 lines

and then:

   mt -f /dev/tapes/tape0 rewind
   dd if=/dev/tapes/tape0 bs=32k | gzip -d | tar --compare -v -f -

The above is the proper way to talk to a tape drive through gzip.

So you make gzip use blocks of 32 kB.

Do you also mean it is illegal to use blocksize 10 kB (default tar, no gzip) with a tape drive??

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw
Quoted 2 lines · Geert Uytterhoeven

Do you also mean it is illegal to use blocksize 10 kB (default tar, no gzip) with a tape drive??

not at all. Infact, with the default settings of the st driver, any multiple of 512 bytes is ok. The additional dd step is just there to be sure everything is fine. If gzip always outputs multiple of 512 bytes then everything is fine. I do this as precaution, since on Solaris with an old Exabyte tape if you didn't do the extra dd you had various bizarre problems. Linux is much nicer, but ...

Now if you change st defaults to e.g. variable block mode, then it changes a bit the equation: you need to read exactly the same size of block (e.g. bs=32k) else you get an error.

Variable block mode is mt -f /dev/nst0 setblk 0.

#3 lore raw
In reply to Geert Uytterhoeven
Quoted 1 line · In article <[email protected]> you…

So you make gzip use blocks of 32 kB.

no, infact it really makes it using blocks of 4k (a PIPE_SIZE is 4k), so it is really equivalent to bs=4k. dd doesn't re-join blocks when they are smaller then bs=, unless you specify obs=32k.

I have been playing with buffer recently and mixed up both. buffer is really a nice tool.

But as I said, as long as you don't play with non-fixed block size you don't have problems.

sorry for mixup.

#4 lore raw
In reply to Marc SCHAEFER
Quoted 1 line
   tar cvf - . | gzip -9 | dd of=/dev/tapes/tape0 bs=32k

I have a tool which compresses individual files in a tar archive instead of the whole archive[1]. That one tries hard to write only in standard 10kb blocks to emulate tar's behavior towards the drive. I'll try in a few days (when I'm back from holidays) if I have this error on my scsi tape too (bad) and if the compression program affects it.

Olaf

[1] <URL:http://sites.inka.de/bigred/sw/tarmill-0.22.tar.gz>