LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tar --incremental OR tar --update , what to use ? (http://www.linuxquestions.org/questions/linux-newbie-8/tar-incremental-or-tar-update-what-to-use-705939/)

crispyleif 02-19-2009 12:09 PM

tar --incremental OR tar --update , what to use ?
 
Yes, I know about rsync, and yes I know about find -mtime :)

I'm trying to learn the basics and I just can't make a decent backup script with tar that makes incremental backups, preserving everything.

Does anyone have a working example on tar incremental backups ?

billymayday 02-20-2009 08:51 PM

I seem to recall that using tar incremental and certain file attributes (SELinux perhaps?) simply doesn't work

What I do is touch a file, and use find to select files modified or created since the dat of that file, so something like

Code:

touch "$DEST"
find /home -daystart -newer $INCREMENT -type f -print0 | xargs -0 tar --selinux -rf "$DEST"

where $INCREMENT points to a file that was touched during my last weekly backup (this is a daily incremental) and $DEST is the destination tarball. I then zip the file once created. I touch the destination initially because I'm adding to it (-r) with tar, so it needs to exist.


All times are GMT -5. The time now is 02:57 PM.