我是磁带归档世界的新手,但我觉得奇怪的是,如果不通过tar -r
选项,我就无法将两个文件写入磁带。
以下是我要做的事情:
$ 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
显然我丢失了first
个文件。我没有看到如何跳过这个第一个tar档案。我试过了:
$ export TAPE=/dev/st0
$ mt fsf 2
/dev/st0: Input/output error
$ mt fsf 1
$ mt tell
At block 0.
我的方案是,我希望两台机器能够创建单独的tarball,然后将每个tarp scp到磁带存档器(cron job)上,以便将两个tar存储为独立的tarball。类似的东西:
$ tar zcf - /home | ssh tape_archiver "cat > /dev/st0"
供参考:
$ 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
根据tldp,应该可以跳过第一个档案。
答案 0 :(得分:1)
似乎解决方案非常简单,只需使用非倒带界面:
$ export TAPE=/dev/nst0
见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