LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   incremental backup using tar (https://www.linuxquestions.org/questions/linux-software-2/incremental-backup-using-tar-276761/)

eaglegst 01-11-2005 11:39 PM

incremental backup using tar
 
Suppose I have done a full backup by using:
tar cvf backup.tar /home/toBackup
Can someone please tell me the command to do an incremental backup?

I read the manpage, but got confused with the -G -g -N options :-(

Thanks a lot!

scuzzman 01-12-2005 12:46 AM

What do you mean by incremental? You mean just backup the things that have changed?
If so, I'd just let it overwrite the backup.tar with the new one.

eaglegst 01-12-2005 01:10 AM

Well, that works fine if you have a small-sized directory to backup, but if the full backup is something like a few GB files, and only a few MB get changed since then, I do not really want to tar the whole thing again. The more you need to backup, the worse this approach works.

That heavy weigh backup is not really my case though. I am just thinking how I can do it, given an extreme situation.

scuzzman 01-12-2005 02:24 AM

Well, try sticking the -g/-G options in there to see if it works... ie: on a practice tar file...

theYinYeti 01-12-2005 06:50 AM

You can use find to select only the files that are newer than the previous backup file.

Yves.

vls 01-12-2005 07:01 AM

Quote:

Originally posted by eaglegst
Well, that works fine if you have a small-sized directory to backup, but if the full backup is something like a few GB files, and only a few MB get changed since then, I do not really want to tar the whole thing again. The more you need to backup, the worse this approach works.

That heavy weigh backup is not really my case though. I am just thinking how I can do it, given an extreme situation.

Tar can't do incremental backups as far as I know.

There is the '--compare option' to see if files in the tar are different from the file system.
You could see what's different , e.g., new files on the system, yank out and delete the old files in the tar and then add the new ones.

It ain't as straight forward as you're hoping it would be. 8-]


Take a look at the [URL=http://rsync.samba.org]rsync.samba.org[/URL rsync] command.

After you set up an initial backup directory using rsync, any time you use it again, it only copies files that have changed. rsync plus the tar --compare option would be a good place to start.

Skip the man page and read the info file for tar. It has a tutorial walk-through that may benefit you.

vls

Updating my original statements.

You can get incremental behavior from tar, just not the way you want it to or think how it works.

If what you want to do is replace a file in a tar archive with a newer versioin, that just ain't happening. Not directly. You would need to do the compare delete , append route.

With the --listed-incremental option,
you can create a new archive containing only the new versions of
of files in the archive that have changed on the file system.

Of course I could be absolutely wrong, but I don't think I am. (not trying to be funny)

theYinYeti 01-13-2005 02:28 AM

Code:

# cd /place/to/backup
# find . ! -type d -newer /where/backups/are/file1.tar -print | xargs tar cf /where/backups/are/file2.tar


KimVette 01-13-2005 10:21 AM

Quote:

Originally posted by vls
Tar can't do incremental backups as far as I know.

GNU tar can though and that is what you get with most (all?) recent distributions.

rajeshkerala 02-01-2009 04:03 PM

Performing incremental backups with tar:

find / -mtime -1 -type f -print
This will give the files which have changed since the last 24 hours. So, we can back up only these files by means of the command

tar cvf /dev/st0 'find / -mtime -1 -type f -print'

jlinkels 02-01-2009 05:00 PM

Star can do incremental backups.
http://linux.softpedia.com/get/Syste...tar-1058.shtml

Currently star is part of my distro. However when I looked at them man page of star here: http://linux.about.com/library/cmd/blcmdl1_star.htm there was no mention of an incremental option. The program in the first link does. I wonder whether it is the same version or that the man page is incomplete.

Whatever, some time ago I switched to rsync to do backups. Even if you have a fast archive program, it takes a very long time before the one file you were looking for is located in the tar file. With rsync it is a matter of seconds.

jlinkels


All times are GMT -5. The time now is 01:55 PM.