Hi Yakul,

Incremental archives cannot be created from different source directories.

> intended bahaviour would be that archive1.tar.gz should container only
> 'testfile'. But it is taking the archive of all the contents.

You extract from your archive before creating second archive.  This
changes inode numbers of all files, so they all look new to the second
tar invocation (snapshot file records device and inode numbers; a file
is considered new if its device/inode pair is not found in the
snapshot).

> Any pointers would be helpful

Two important points.  First, remove your extraction attempt.  It serves
no purpose anyways, except for clobbering inode numbers.

Secondly, don't reuse the snapshot file in the subsequent attempt.  You
might need it later.  Instead of

> echo "Taking second snapshot"
> tar -z --create --file archive1.tar.gz \
>     --listed-incremental=/home/yakul/snapshot.file --same-owner ...

do this:

  echo "Taking second snapshot"
  cp /home/yakul/snapshot.file /home/yakul/snapshot1.file
  tar -z --create --file archive1.tar.gz \
      --listed-incremental=/home/yakul/snapshot1.file --same-owner ...

Regards,
Sergey

Reply via email to