[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] Incremental extract improvement

From: Helmut Waitzmann
Subject: Re: [Bug-tar] Incremental extract improvement
Date: Wed, 17 May 2006 00:16:34 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

Ian Turner <address@hidden> writes:

>Maybe I am confused about the way that tar stores listed-incremental

My Version of GNU tar is
$ tar --version
tar (GNU tar) 1.15.1

>My understanding was that archive members could be of two forms:  --
>Delete this file, which appeared in the full but disappeared for the
>incremental dump.  -- Add/Replace this file, which is provided here in
>the archive.
>But it seems that actually perhaps archive members are of two
>different forms:
>-- Ignore this file, which appeared in the full and was unchanged for
>the incremental
>-- Add/Replace this file, which is provided here in the archive.
>With the former format, it becomes possible to truly apply the
>"changes" made in the incremental backup. But with the second format,
>it is impossible; files which are listed in the full but should be
>deleted are simply not mentioned in the incremental.
>Is my (second) understanding correct?

Yes and no.


If you use the "--listed-incremental" option, then for each of the
directories that are to be archived tar stores in the tape archive a
list of all file names of the entries of that directory.

The tar info documents say about the incremental options:

      `--incremental' (`-G') in conjunction with `--create' (`-c')
   causes `tar' to write, at the beginning of the archive, an entry
   for each of the directories that will be archived.  The entry for a
   directory includes a list of all the files in the directory at the
   time the archive was created and a flag for each file indicating
   whether or not the file is going to be put in the archive.

So the archive members are of these forms:

>-- Ignore this file, which appeared in the full and was unchanged for
>the incremental
>-- Add/Replace this file, which is provided here in the archive.

And no:

As tar stores all file names of a directory (regardless of whether the
files themselves are stored in the incremental archive or not), it
/knows/ which files are to be deleted when incremental extracting an
incremental archive:  It simply deletes all files which names are
/not/ in the incremental archive, thus truly applying the changes,
which were made in the file system between this incremental backup and
its preceding (incremental or full) backup.

The tar info documents say:

      `--incremental' (`-G') in conjunction with `--extract' (`--get',
   `-x') causes `tar' to read the lists of directory contents
   previously stored in the archive, _delete_ files in the file system
   that did not exist in their directories when the archive was
   created, and then extract the files in the archive.

      This behavior is convenient when restoring a damaged file system
   from a succession of incremental backups: it restores the entire
   state of the file system to that which obtained when the backup was
   made.  If `--incremental' (`-G') isn't specified, the file system
   will probably fill up with files that shouldn't exist any more.

      `--listed-incremental=SNAPSHOT-FILE' (`-g SNAPSHOT-FILE') acts
   like `--incremental' (`-G'), but when used in conjunction with
   `--create' (`-c') will also cause `tar' to use the file
   SNAPSHOT-FILE, which contains information about the state of the
   file system at the time of the last backup, to decide which files
   to include in the archive being created.  That file will then be
   updated by `tar'.  If the file FILE does not exist when this option
   is specified, `tar' will create it, and include all appropriate
   files in the archive.

      `tar' doesn't access SNAPSHOT-FILE when `--extract' (`--get',
   `-x') or `--list' (`-t') are specified, but the
   `--listed-incremental=SNAPSHOT-FILE' (`-g SNAPSHOT-FILE') option
   must still be given.  A placeholder SNAPSHOT-FILE can be specified,
   e.g., `/dev/null'.

   `--incremental' (`-G') is used in conjunction with `--create'
   (`-c'), `--extract' (`--get', `-x') or `--list' (`-t') when backing
   up and restoring file systems.  An archive cannot be extracted or
   listed with the `--incremental' (`-G') option specified unless it
   was created with the option specified.  This option should only be
   used by a script, not by the user, and is usually disregarded in
   favor of `--listed-incremental=SNAPSHOT-FILE' (`-g SNAPSHOT-FILE'),
   which is described below.

If you want tar to delete obsolete files when extracting an
incremental archive, give tar the "--listed-incremental" option.

If you don't want tar to delete obsolete files (but merely extract new
ones), don't specify that option.
Wenn Sie mir E-Mail schreiben, stellen  | When writing me e-mail, please
Sie bitte vor meine E-Mail-Adresse      | precede my e-mail address with
meinen Vor- und Nachnamen, etwa so:     | my full name, like
Helmut Waitzmann <address@hidden>, (Helmut Waitzmann) address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]