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


Including a Label in the Archive

@UNREVISED

-V name
--label=name
Create archive with volume name name.

This option causes tar to write out a volume header at the beginning of the archive. If --multi-volume (-M) is used, each volume of the archive will have a volume header of `name Volume n', where n is 1 for the first volume, 2 for the next, and so on.

@FIXME{Should the arg to --label be a quoted string?? No.}

To avoid problems caused by misplaced paper labels on the archive media, you can include a label entry--an archive member which contains the name of the archive--in the archive itself. Use the --label=archive-label (-V archive-label) option in conjunction with the --create (-c) operation to include a label entry in the archive as it is being created.

If you create an archive using both --label=archive-label (-V archive-label) and --multi-volume (-M), each volume of the archive will have an archive label of the form `archive-label Volume n', where n is 1 for the first volume, 2 for the next, and so on. @FIXME-xref{Multi-Volume Archives}, for information on creating multiple volume archives.

If you list or extract an archive using --label=archive-label (-V archive-label), tar will print an error if the archive label doesn't match the archive-label specified, and will then not list nor extract the archive. In those cases, archive-label argument is interpreted as a globbing-style pattern which must match the actual magnetic volume label. See section Excluding Some Files, for a precise description of how match is attempted(7). If the switch --multi-volume (-M) is being used, the volume label matcher will also suffix archive-label by ` Volume [1-9]*' if the initial match fails, before giving up. Since the volume numbering is automatically added in labels at creation time, it sounded logical to equally help the user taking care of it when the archive is being read.

The --label=archive-label (-V archive-label) was once called `--volume', but is not available under that name anymore.

To find out an archive's label entry (or to find out if an archive has a label at all), use `tar --list --verbose'. tar will print the label first, and then print archive member information, as in the example below:

$ tar --verbose --list --file=iamanarchive
V--------- 0 0        0 1992-03-07 12:01 iamalabel--Volume Header--
-rw-rw-rw- ringo user 40 1990-05-21 13:30 iamafilename
--label=archive-label
-V archive-label
Includes an archive-label at the beginning of the archive when the archive is being created, when used in conjunction with the --create (-c) option. Checks to make sure the archive label matches the one specified (when used in conjunction with the --extract (--get, -x) option.

To get a common information on all tapes of a series, use the --label=archive-label (-V archive-label) option. For having this information different in each series created through a single script used on a regular basis, just manage to get some date string as part of the label. For example:

$ tar cfMV /dev/tape "Daily backup for `date +%Y-%m-%d`"
$ tar --create --file=/dev/tape --multi-volume \
     --volume="Daily backup for `date +%Y-%m-%d`"

Also note that each label has its own date and time, which corresponds to when GNU tar initially attempted to write it, often soon after the operator launches tar or types the carriage return telling that the next tape is ready. Comparing date labels does give an idea of tape throughput only if the delays for rewinding tapes and the operator switching them were negligible, which is ususally not the case.

@FIXME{was --volume}


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