Ubuntu – tar incremental backup with –listed-incremental does not work for me (Linux, Ubuntu)

backuptarUbuntu

according to http://www.gnu.org/software/automake/manual/tar/Incremental-Dumps.html, i try to create incremental backups with tar and –listed-incremental on my Ubuntu, but the –listed-incremental part does not work for me.

On day 0 I execute:

SNAR_TODAY=`date +%Y_w%U_${DOW}`
TARGET='/srv/backups/'
SOURCE='/srv/data'
FILENAME=`date +%Y%m%d_%H%M`

tar -cvf $TARGET/$FILENAME.tar --atime-preserve --listed-incremental=$TARGET/$SNAR_TODAY.snar $SOURCE &> $TARGET/$FILENAME.log

Does work fine and creates a full backup of my /srv/data and a 2011_wXY_0.snar.

On day 1-6 I execute:

DOW=`date +%u`
TODAY=$DOW
YESTERDAY=`expr $TODAY - 1`
SNAR_TODAY=`date +%Y_w%U_${TODAY}`
SNAR_YESTERDAY=`date +%Y_w%U_${YESTERDAY}`

TARGET='/srv/backups/'
SOURCE='/srv/data'
FILENAME=`date +%Y%m%d_%H%M`

cp -p $TARGET/$SNAR_YESTERDAY.snar $TARGET/$SNAR_TODAY.snar
tar -cvf $TARGET/$FILENAME.tar --atime-preserve --listed-incremental=$TARGET/$SNAR_TODAY.snar $SOURCE &> $TARGET/$FILENAME.log

Problem: tar creates a new .tar of the complete directory – not doing any incremental stuff.

System: Linux srv03 2.6.32-28-server #55-Ubuntu SMP

$ tar --version
tar (GNU tar) 1.22
Copyright (C) 2009 Free Software Foundation, Inc.

And yes i know, there are many pre-built solutions out there, but there are some reasons why i build my own. Thanks for any ideas why tar is not working for me as i expect.

Best Answer

Looks like --atime-preserve break incremental backups. :( Try --atime-preserve=system - it's not documented on man page, but works.