5

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.

2 Answers 2

3

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

1
  • I now had time to test this: and you are absolutely right: with "=system" behind the --atime-preserve its working as expected! Thank you very much! Oct 5, 2012 at 12:59
1

I do tar tar ((GNU tar) 1.23) based incremental backups as well (using cron): this is the (slightly modified) output of crontab -l from my setup:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin

0 0 * * 1-6 tar czfg /path/to/website/backups/website_inc_`date +\%Y\%m\%d`.tgz /path/to/website/backups/website.info -C /path/to/website/ public_html

0 0 * * 0 tar czfg /path/to/website/backups/website_inc_`date +\%Y\%m\%d`.tgz /path/to/website/backups/website.info --level=0 -C /path/to/website/ public_html

c = create; z = gzip compress; f=file; g=incremental; -C = directory to change to(

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .