LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-11-2005, 11:39 PM   #1
eaglegst
Member
 
Registered: Dec 2003
Location: Australia
Distribution: Woody, Sarge, Sid
Posts: 83

Rep: Reputation: 15
Question 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!
 
Old 01-12-2005, 12:46 AM   #2
scuzzman
Senior Member
 
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
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.
 
Old 01-12-2005, 01:10 AM   #3
eaglegst
Member
 
Registered: Dec 2003
Location: Australia
Distribution: Woody, Sarge, Sid
Posts: 83

Original Poster
Rep: Reputation: 15
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.

Last edited by eaglegst; 01-12-2005 at 01:12 AM.
 
Old 01-12-2005, 02:24 AM   #4
scuzzman
Senior Member
 
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
Well, try sticking the -g/-G options in there to see if it works... ie: on a practice tar file...
 
Old 01-12-2005, 06:50 AM   #5
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

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

Yves.
 
Old 01-12-2005, 07:01 AM   #6
vls
Member
 
Registered: Jan 2005
Location: The grassy knoll
Distribution: Slackware,Debian
Posts: 192

Rep: Reputation: 31
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)

Last edited by vls; 01-15-2005 at 10:52 AM.
 
Old 01-13-2005, 02:28 AM   #7
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
Code:
# cd /place/to/backup
# find . ! -type d -newer /where/backups/are/file1.tar -print | xargs tar cf /where/backups/are/file2.tar
 
Old 01-13-2005, 10:21 AM   #8
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Rep: Reputation: 46
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.
 
Old 02-01-2009, 04:03 PM   #9
rajeshkerala
Member
 
Registered: Mar 2008
Posts: 35

Rep: Reputation: 15
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'
 
Old 02-01-2009, 05:00 PM   #10
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
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
 
  


Reply



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
Incremental Backup (tar command) maginotjr Slackware 4 07-21-2005 01:04 AM
rsync incremental backup sachin_keluskar Linux - Software 1 06-29-2005 02:09 AM
Incremental backup script - Tar problem joshheald Linux - Software 1 09-28-2004 10:02 AM
Getting date format right in tar incremental backup jonr Linux - Software 3 08-19-2004 09:53 AM
incremental backup reaky Linux - Software 3 03-10-2004 03:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:21 AM.

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