backup and update the backup file
What is the best way to backup a directory? tar?
Is "tar" capable of updating an old archive with newer files without creating a new archive?
tar can replace files in principle, but since you almost certainly want a compressed archive, it's not practical. What you should look at are incremental backups, like do a full backup once a month or so and then daily backups of just the files that changed. tar supports that nicely; I have been running my backups this way for years. If you like, I can give you my script that does that.
Yes, that is exactly what I want.
Please post it or email to me.
I vote for a post! That would be cool info to have and use.
Ok here it comes - there is the preamble-style define section for all customizations; you can easily tweak it for your purposes.
The script goes through all directories underneath TOPDIR (/home). The BACKUPDIR (/backup/incremental) is another disk where the backups go. For each run of the script (at this point, I run it every Saturday night from cron), it creates a new directory in BACKUPDIR (such as "2002-08-25" this night) from the date. The way the date is used, you cannot run this more than once a day (generates just one directory for a given day).
The find command in the for loop finds all top-level user directories (the -name cuts out the "." and ".."), minus the "lost+found".
Since we need to allow for tar files larger than 2GB, I tar the contents to stdout, pipe into gzip and then split into 2 million bytes chunks. Note the trailing "." in the filename -- split (which reads from stdin) then makes user_2002-08-25.tar.gz.aa, bb, cc and so on. Usually, for small enough directories, you just get the .aa file. If you happen to have more and need to restore, you just
cat user_2002-08-25.tar.gz.* | tar xv ...
If you want a full backup (I usually go 1 full, 7 incrementals), just blow away the contents of the "INCREMENTALSINFO" directory - no info about incrementals equals a full backup.
Hope it's useful,
|All times are GMT -5. The time now is 01:49 AM.|