Backup, what system files are *really* important?
Rick Stevens
ricks at nerd.com
Fri Mar 12 18:54:57 UTC 2010
On 03/12/2010 10:11 AM, Craig White wrote:
> On Fri, 2010-03-12 at 10:59 -0700, Stuart McGraw wrote:
>> On 03/11/2010 09:02 PM, Craig White wrote:
>>> On Thu, 2010-03-11 at 22:32 -0430, Patrick O'Callaghan wrote:
>>>> On Thu, 2010-03-11 at 18:54 -0700, Craig White wrote:
>>>>> On Thu, 2010-03-11 at 20:13 -0430, Patrick O'Callaghan wrote:
>>>>>> On Thu, 2010-03-11 at 18:29 -0600, Mike McCarty wrote:
>>>>>>> Patrick O'Callaghan wrote:
>>>>>>>>
>>>>>>>> I back up all of /etc and /usr/local. Also /opt if it exists.
>>>>>>>
>>>>>>> Is /opt really likely to contain some configuration information
>>>>>>> that a reinstall wouldn't set up? ISTM that, if the system
>>>>>>> is "modern" enough to use /opt for its install, then its config
>>>>>>> would also be in /var. Not so?
>>>>>>
>>>>>> /opt (and /usr/local) are likely to contain stuff that wasn't installed
>>>>>> via rpm or yum, thus needs to be preserved. That's all. YMMV.
>>>>>>
>>>>> ----
>>>>> what about /var ?
>>>>>
>>>>> /var/www/html
>>>>> /var/www/named
>>>>> /var/lib/dhcpd
>>>>> /var/lib/imap
>>>>> /var/cache/samba
>>>>>
>>>>> come immediately to my mind
>>>>
>>>> I don't run public services on my personal machine so much of that
>>>> doesn't matter to me. Plus anything with "cache" in its pathname is
>>>> excluded by my backup script as a matter of course.
>>>>
>>>> I do back up /var/log though. You never know.
>>> ----
>>> yeah but if it's a samba server... unfortunate that redhat packagers
>>> chose to use /var/cache/samba for important files
>>
>> I backup /etc/samba/smb.conf (the only file there I've
>> modified.) There are less than a dozen samba users here.
>> I have notes about how to add them using pdbedit. Since
>> this was how I set up samba originally, I am assuming
>> that redoing the same process will produce the same
>> results including the stuff in var/cache/samba?
>> Am I missing something?
> ----
> well it appears that they finally moved the contents of what used to be
> in /var/cache/samba to /var/lib/samba (yeah) but the contents are all of
> the internal tdb (trivial data base) files that samba uses for things
> like policies created by pdbedit, share information, etc. If you are
> running a samba server, you should be backing those up.
Historically, I've used a script that walks down /etc/passwd and picks
up all the home directories, sorts them, then uniqs them and I make sure
those get backed up. I also back up /etc and /var (except /var/log).
Then again, depending on your backup media, there's no reason to not
back up the entire system (excluding transient trees such as /proc,
/dev and the like).
I do so using rsync to a server on my LAN (prophead) which has a 500GB
USB drive formatted with ext3 mounted at /media/500GB-Drive with a
directory called "Backups" on it. Prophead's /etc/rsyncd.conf file
contains:
uid = root
gid = root
use chroot = yes
[backup]
comment = Backup directory
path = /media/500GB-Drive/Backups
hosts allow = 192.168.1.52 192.168.1.53
read only = no
Start up rsync in daemon mode:
# rsync --daemon
and it's ready to go.
The clients (the machines being backed up) run this script:
#!/bin/bash
# Back up system to a specific directory given on the command
# line. Excludes the /proc, /sys, /dev and /media directories
MYHOST=`hostname`
TODAY=`date +%d-%b-%Y`
if [ $# -lt 1 ]; then
TGT="$MYHOST-BackUp-$TODAY"
else
TGT=$1
fi
rsync -avXA --exclude-from=/etc/skipdirs.rsync / \
prophead::backup/$TGT
The content of the "/etc/skipdirs.rsync" file on the clients is:
/proc/*
/sys/*
/dev/*
/media/*
I make this a free gift to all. It's quick and dirty, but it gets the
job done. "If it's stupid and it works, it ain't stupid!"
Note: You'll get SELinux alerts on the rsync server when you do the
backup from the client (the /media/500GB-Drive/Backup directory won't
have the correct SELinux contexts), so put SELinux in permissive mode
on the server before you tell the client to back up.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, C2 Hosting ricks at nerd.com -
- AIM/Skype: therps2 ICQ: 22643734 Yahoo: origrps2 -
- -
- Change is inevitable, except from a vending machine. -
----------------------------------------------------------------------
More information about the users
mailing list