[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: lenny backups and recovery



On 20100114_133757, Adam Hardy wrote:
> Just recovered from a kernel-not-loading situation, without any data
> loss and happily wondering what I should do now to make sure I don't
> get the same adrenalin shot next time it happens.
> 
> I do have a removable usb hard drive for backups, onto which I copy
> stuff using cp -rp *
> 
> and I'm wondering how I should copy my linux configuration, and then
> how I restore it too when needed.
> 
> Do I just do
> 
> cp -rp /etc /media/external
> 
> and on recovery, just install all packages and then copy the whole /etc back?
> 
> I am looking at http://www.tldp.org/HOWTO/Linux-Complete-Backup-and-Recovery-HOWTO/overview.html
> but it was last updated in 2006 so I figure there might be some
> useful new stuff too somewhere.
> 
> Also wondering what the lenny installation cd 'rescue mode' does -
> and whether I need a boot floppy with a copy of my partition info?

Hi, Adam

I took a look at the tldp document and don't like it. I would even
characterize it as somewhat wrong headed. I understand the goal, but...

For you, an individual user of a self administered Lenny, there are
things that you need not do (because you are using Debian) and things
that they advise, but that I think are ill advised, whatever your OS.

I think that your disaster recovery system should not be something
that is separate and distinct from your daily backups. Rather it
should be integrated into your daily system in such a way that you are
aware that it has done its data recording function within the last 24
hours --- always. You may think you cannot afford to do a full backup
-every- -day-, but you can, if you use, for example, rsync, instead of
cp. The first time that you use rsync to do a backup it is no faster
than cp, but subsequent backups automatically copy only the files that
have actually changed and only the changed portions of those changed
files. Furthermore, rsync has an operating mode in which it uses
hard-links to allow you to keep many daily backups.

Contrary to tldp advice, I think it is unnecessary to make backups
of /bin or /sbin. These files are readily available from you favorite
Debian repository, and if your system has crashed in some serious 
way, you would be well advised to download again, once you think you
have resolved the issue that caused the crash. Think about it ---
if you have to restore one of these, something really bad has happened
and you can't be sure that something -else- bad hasn't also happened - 
but you haven't noticed it - yet. 

But there are files that are you own, entirely, or contain little gems
of information about your personal setup. You should make backups of
these, i.e. daily backup using rsync. So you should
make backups of /home and /etc, at least.

Now a big advantage of Debian: The File Heirarchy Standard (FHS)
limits the number of different places user information can be
stored. If you read it and place you stuff only according to FHS, you
can be confident that you that your configuration stuff is only in
/etc (but only if you only use software that has been package by
Debian). So you really shouldn't need to backup anything else.

But there are exceptions:
1. Personal crontabs are in /var/spool/cron/crontabs.

2. Definitive information about what kernel you are running is in /boot.

3. Definitive information about what packages are installed.

4. You need to have a place to keep the code for your backup system where
it won't conflict with every day user/sysadmin work, and common advice
about how to do that work. I put the core stuff of my backup in /root,
including a package-list generated daily by aptitude:

aptitude -F "%p %M" search '~i' |tr -s ' '|sed 's/ A$/+M/' >/root/package-list


So, IMHO, what needs to be backed up is:
/boot /etc /home /root /var/spool/cron/crontabs

The rest may be essential for a functioning personal computer, but not
for recovery from a mistake or malfunction.


Note on rsync:

To use rsync as I do, you need to be aware of the option, 
--link-dest=<file>.

This option gives to rsync a link to a candidate file system that 
contains an old version of the files that are being backed up, i.e.
yesterday's backup. If a file from yesterday still matches the file
that is being backed up, rsync simply makes a hard-link in today's 
file structure to that file in yesterday's file structure. 


-- 
Paul E Condon           
pecondon@mesanetworks.net


Reply to: