سؤال

I am new to tape archive world, but I find it odd that I cannot write two files to a tape without going through the tar -r option.

Here is what I am trying to do:

$ cd /tmp
$ touch first second
$ tar cvf /dev/st0 first
$ tar cvf /dev/st0 second
$ tar tvf /dev/st0
-rw-r--r-- mathieu/mathieu   0 2014-02-21 15:00 second

Obviously I've lost first file. I fail to see how I could possible skip this first tar archive. I tried:

$ export TAPE=/dev/st0
$ mt fsf 2
/dev/st0: Input/output error
$ mt fsf 1
$ mt tell
At block 0.

My scenario is that I want two machines be able to create individual tarballs and then scp each onto the tape archivers (cron job) to stores thoses two as separated tarballs. Something like:

$ tar zcf - /home | ssh tape_archiver "cat > /dev/st0"

For reference:

$ mt status
SCSI 2 tape drive:
File number=0, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x40 (DLT1 40 GB, or Ultrium).
Soft error count since last status=0
General status bits on (41010000):
 BOT ONLINE IM_REP_EN

According to tldp it should be possible to skip the first archive.

هل كانت مفيدة؟

المحلول

It seems the solution is pretty trivial, simply use the non-rewinding interface:

$ export TAPE=/dev/nst0

As seen here:

You seem to be using the device /dev/st0 which is a SCSI tape device. There is no problem with using that device, but it will always do a rewind after every completed access to that device. So after you have written a tar file to the device, it will do a rewind afterwards.

You wil need the device /dev/nst0. The "n" stands for no-rewind. After writing to that device, the tape position stays at the end of the tape. Try using the following commands:

mt -f /dev/nst0 rewind
tar cvf /dev/nst0 $HOME
mt -f /dev/nst0 status
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top