Go to the first, previous, next, last section, table of contents.


Using Multiple Tapes

@UNREVISED

Often you might want to write a large archive, one larger than will fit on the actual tape you are using. In such a case, you can run multiple tar commands, but this can be inconvenient, particularly if you are using options like --exclude=pattern or dumping entire filesystems. Therefore, tar supports multiple tapes automatically.

Use --multi-volume (-M) on the command line, and then tar will, when it reaches the end of the tape, prompt for another tape, and continue the archive. Each tape will have an independent archive, and can be read without needing the other. (As an exception to this, the file that tar was archiving when it ran out of tape will usually be split between the two archives; in this case you need to extract from the first archive, using --multi-volume (-M), and then put in the second tape when prompted, so tar can restore both halves of the file.)

GNU tar multi-volume archives do not use a truly portable format. You need GNU tar at both end to process them properly.

When prompting for a new tape, tar accepts any of the following responses:

?
Request tar to explain possible responses
q
Request tar to exit immediately.
n file name
Request tar to write the next volume on the file file name.
!
Request tar to run a subshell.
y
Request tar to begin writing the next volume.

(You should only type `y' after you have changed the tape; otherwise tar will write over the volume it just finished.)

If you want more elaborate behavior than this, give tar the --info-script=script-name (--new-volume-script=script-name, -F script-name) option. The file script-name is expected to be a program (or shell script) to be run instead of the normal prompting procedure. When the program finishes, tar will immediately begin writing the next volume. The behavior of the `n' response to the normal tape-change prompt is not available if you use --info-script=script-name (--new-volume-script=script-name, -F script-name).

The method tar uses to detect end of tape is not perfect, and fails on some operating systems or on some devices. You can use the --tape-length=1024-size (-L 1024-size) option if tar can't detect the end of the tape itself. This option selects --multi-volume (-M) automatically. The size argument should then be the usable size of the tape. But for many devices, and floppy disks in particular, this option is never required for real, as far as we know.

The volume number used by tar in its tape-change prompt can be changed; if you give the --volno-file=file-of-number option, then file-of-number should be an unexisting file to be created, or else, a file already containing a decimal number. That number will be used as the volume number of the first volume written. When tar is finished, it will rewrite the file with the now-current volume number. (This does not change the volume number written on a tape label, as per section Including a Label in the Archive, it only affects the number used in the prompt.)

If you want tar to cycle through a series of tape drives, then you can use the `n' response to the tape-change prompt. This is error prone, however, and doesn't work at all with --info-script=script-name (--new-volume-script=script-name, -F script-name). Therefore, if you give tar multiple --file=archive-name (-f archive-name) options, then the specified files will be used, in sequence, as the successive volumes of the archive. Only when the first one in the sequence needs to be used again will tar prompt for a tape change (or run the info script).

Multi-volume archives

With --multi-volume (-M), tar will not abort when it cannot read or write any more data. Instead, it will ask you to prepare a new volume. If the archive is on a magnetic tape, you should change tapes now; if the archive is on a floppy disk, you should change disks, etc.

Each volume of a multi-volume archive is an independent tar archive, complete in itself. For example, you can list or extract any volume alone; just don't specify --multi-volume (-M). However, if one file in the archive is split across volumes, the only way to extract it successfully is with a multi-volume extract command `--extract --multi-volume' (`-xM') starting on or before the volume where the file begins.

For example, let's presume someone has two tape drives on a system named `/dev/tape0' and `/dev/tape1'. For having GNU tar to switch to the second drive when it needs to write the second tape, and then back to the first tape, etc., just do either of:

$ tar --create --multi-volume --file=/dev/tape0 --file=/dev/tape1 files
$ tar cMff /dev/tape0 /dev/tape1 files


Go to the first, previous, next, last section, table of contents.