I'm working on a project where I'll be using tar
to incrementally backup data on a server to a number of tapes. According to a senior co-worker of mine, tar
will "set special flags on files so that it can tell if the files has been modified since last backup." I was never aware that tar
could ever modify source files (other than deleting).
I've been having a heck of a time going though the GNU tar help page and the UNIX tar man page but I can not yet either verify or disprove what he said. So, is this complete bull and I'll have to use something like Bacula or can I do what he was explaining (and how)?
Cheers! Russell C
- 115
- 1
- 1
- 8
2 Answers
Is your colleague a Windows guy? Because on Windows, there is the a
(for archive) attribute which is set whenever a file is modified and is supposed to be cleared when a backup program backs it up.
On Unix/Linux, backup programs normally use the ctime/mtime values of a file do decide if they need to backup the file - if the time is newer than in the backup, save it.
You can tell tar to backup only files newer than the last backup with the -N
or --newer
option.
-
Ah, Sven! You followed me! My colleague claims to be a Linux guy (and seems to know a decent amount) but frequently says things that are very... questionable. The problem that I have is that I won't have a list of backed up files to reference. The size of a backup tape is fairly small compared to the amount of data we will be backing up (and taking offsite). Because of this, I only will have one copy and need to arbitrarily know what needs to be backed up (like what @iain has suggested). – Russell C Feb 09 '11 at 20:41
I don't think that tar will do that as the filesystems don't have "special flags". You can use the -N DATE
or --newer DATE
switch to backup files newer than DATE. You can use --newer-mtime DATE
to backup files that have been modified since DATE. You can also use -g file
or --listed-incremental=file
to store meta data in an external file that can then be referenced for making incremental backups.
- 114,104
- 20
- 206
- 289
-
Thanks, @iain! This looks like something that I'll be able to easily implement (at least for the short term). – Russell C Feb 09 '11 at 21:03
-
It looks like I'll either be using a system like this (a tad ugly and unreliable since it could miss some files if the last backup fails) or using the output of the CMS that we're thinking of implementing that will automagically generate a log with changed files that need backing up. – Russell C Feb 10 '11 at 16:17