Paul Stear wrote:

Hi all,
I have been working on a backup solution for my home system and have a full backup of /home and then incremental backups for the rest of the week.
I know how to uncompress and and action the full backup, but have 2 questions regarding the incremental.
The incremental only tar the files that have changed or are new, which is what I want, however, my script also saves empty directories, which I don't want.
1. How can I exclude empty directories?


That's a tricky question since we can't look at your script, but if you're using the Bourne shell (sh or bash),
you could use


if ls "$DIR" | grep ^ >/dev/null; then
# directory "$DIR" is not empty
else
# directory "$DIR" is empty
fi

This will not cover nested directories though, e.g. if directory x contains only directory y, and directory y is
empty, x will not be regarded as empty, too.


2. What is the correct way to install the incremental backups after the full backup is installed so that my home directory is back to normal i.e. I don't want full directories over written with empty ones or end up with just a few files.


You would need to store the information which files and directories were removed as well
in your incremental backups. The way you would restore these would be the same way you created them.
A full backup would be restored by deleting the previous directory and then installing the full tar file (e.g.)
or, probably safer, to untar first and then remove files and directories not in the backup. An incremental
backup stores only the differences between two system states. E.g. if your incremental backup stored the differences
between the August 7 full backup and the August 8 FS state, the correct way to install it would be to first
restore the system to the August 7 state and then replay the August 7 to August 8 incremental backup.


I would strongly recommend against actually deleting files from home directories, moving them to a temporary
directory where you can manually sift through them seems much wiser.


Maybe however you'll find it simpler and safer to use BackupPC (http://backuppc.sourceforge.net) instead.
I can't tell you much about it though since I'm looking forward to using it the first time, too.


This is probably a dumb question, but I am learning.


It's not a dumb question at all!


-- [EMAIL PROTECTED] mailing list



Reply via email to