Dale writes:

> Me again.  I'm thinking about writing a bash script that backs up my
> /home directory.  I found a guide but before I read all that stuff and
> muddy up the waters, is this thing current and will it work fine with
> the bash Gentoo uses?  Links to a even better guide would be good too.
> The guide I found is here:
> 
> http://tldp.org/LDP/abs/html/

I learnt bash that way. And by reading the man page over and over again. 
And again. Now I have scripts > 100k in size, I had not expected that bash 
was so powerful.

http://www.shelldorado.com/shelltips/ has some nice tips
http://sayle.net/book/basics.htm#what_is_a_shell explains what a shell is, 
maybe that's something to browse first.

But for the backup: I recommend rdiff-backup and rsnapshot, I use the 
former. Basically, it rsyncs a directory, but allows incremental backups, 
too. After the first backup, the backup directory looks exactly like the 
original directory, except for a 'rdiff-backup-data' folder containing 
additional information. When A drive went bad, I just renamed my 1st and 
2nd drives LVM volume groups and rebooted, now my system ran on the backup 
drive.
The next backups only back up files that have been modified, and save the 
compressed differences into the rsync-backup-data folder.

rsnapshot works similar (but I did not use it yet). The main difference is 
that rsnapshot creates a whole directory for every backup, containing 
exactly the files as they were present at the time of backup. Files that 
stayed the same are not copied, but hard-linked so they take up no extra 
space.

So, I would say, rsnapshot is more practical, at the expense of storage 
space. If you need a file from an older backup, juts look into the 
corresponding directory, it is there, just copy it over, no need to use a 
backup tool to restore stuff. If you want to save space, try rdiff-backup. 
But if you need a file not from the last backup, but from an earlier one, 
you need to extract it first with rsnapshot (No big deal, still).

My backup script was written in bash of course. It has some targets like 
'home', 'usr', 'opt' (backup this partition) and extras like 'src' (create 
.tbz2 files of /usr/src/linux-*), 'etc' (tar /etc) or 'kde' (tar ~/.kde*, 
I regularly do this before I save the session, because this often does not 
work). All my data is on LVM volumes, so when a partition is to be backed 
up, a LVM snapshot is created and used for the backup. So I can continue 
working in my home directory and change data during the backup.
The script is here: http://wonkology.org/~wonko/tmp/backup

        Wonko

Reply via email to