Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

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

share|improve this answer
    
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! –  Rolf Wenger Oct 5 '12 at 12:59
add comment

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(

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.