【问题标题】:Writing multiple files to (rewinding) tape archive将多个文件写入(倒带)磁带存档
【发布时间】:2014-02-21 14:09:38
【问题描述】:

我是磁带存档领域的新手,但我觉得很奇怪,如果不通过 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,然后将每个机器 scp 到磁带存档器(cron 作业)上,以将这两个机器存储为单独的 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,应该可以跳过第一个存档。

【问题讨论】:

  • 哇,我以为磁带不再使用了!
  • 我还应该用什么来备份文件 ~51Gb(CT 扫描)便宜的?我不可能为一个文件使用几十张 DVD。

标签: linux tar


【解决方案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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-05-03
    • 2016-06-25
    • 2023-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-01
    相关资源
    最近更新 更多