Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-28-2008, 12:15 PM   #1
LQ Newbie
Registered: Apr 2008
Posts: 2

Rep: Reputation: 0
Question Creating Differential Backups with Tar

Hey guys,

Im trying to figure out how to create differential backups using the tar command. I have looked in the man pages and I know that the --diff option is primarily used for this task. However I just having problems figuring the syntax for this.

I have tried tar --diff /backup1 -f /backup2 /home and variations of it but clearly having problems.

In addition, I was wondering if the timestamps option (-g) would work by just creating 1 timestamp and comparing each day of the week with that particular timestamp until a full backup has to be completed.

Something like:

tar cv -g /snapshot -f /backup /home

However wouldnt the snapshot file continue to be updated when I run a new backup command thus resulting back to incremental?

Hope someone can help! Thanks in advanced.
Old 04-29-2008, 04:55 AM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
A differential backup will backup changes since the first full backup.

You didn't enough of Section 5.2 of the tar info manual. Just after the instructions to create an incremental backup (the first incremental backup), it explains how to create a subsequent level.1 (differential) backup:
The created archive `archive.2.tar' will contain only these three
members.  This archive is called a "level 1 backup".  Notice that
`/var/log/usr.snar' will be updated with the new data, so if you plan
to create more `level 1' backups, it is necessary to create a working
copy of the snapshot file before running `tar'.  The above example will
then be modified as follows:

     $ cp /var/log/usr.snar /var/log/usr.snar-1
     $ tar --create \
                --file=archive.2.tar \
                --listed-incremental=/var/log/usr.snar-1 \
Just keep copying the initial snapshot file and use the copy for the -g (--listed-incremental) argument. Then the files modified from the initial backup will be backed up because you are using the snapshot file from the initial full backup.

Last edited by jschiwal; 04-29-2008 at 09:13 PM. Reason: grammer fix.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using tar, to make differential Backup on Hard Disk alpha97 Linux - Newbie 3 05-14-2007 05:24 PM
backups using tar and rsync cucolin@ Linux - Server 2 04-03-2007 01:25 AM
Creating/Restoring Backups Corallis Linux - Newbie 4 09-05-2004 11:04 PM
incremental & differential backups to CD? SheldonPlankton Linux - General 0 06-30-2004 06:33 PM
Incremental tar backups Pepe Linux - General 5 03-18-2002 04:31 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:22 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration