BackupPC-users

Re: [BackupPC-users] local host backups

2016-02-11 08:42:47
Subject: Re: [BackupPC-users] local host backups
From: Carl Wilhelm Soderstrom <chrome AT real-time DOT com>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Thu, 11 Feb 2016 08:41:46 -0500
On 02/11 10:50 , Philip Parsons (Velindre - Medical Physics) wrote:
> Firstly, I'm assuming that I should be backing up localhost for backuppc.  
> Please correct me if I'm wrong.  I thought that it would be sensible to have 
> a backup of the settings and exclude all the cpool etc.  If that is correct, 
> I thought that I should use rsync as the backup would be more accurate than 
> tar.  Does this seem reasonable?  I also thought that I should run this 
> backup without any compression so that it could in theory be restored without 
> the need for backuppc.  Please correct me if any of these things don't make 
> sense.

I use tar for my localhost backups. You could use rsync as well, but since
bandwidth isn't a problem and BackupPC does deduplication, it doesn't really
matter if you use tar. Here's my configuration:

# cat localhost.pl 
#
# Local server backup of /etc as user backuppc
#

# dunno why it needs to ping
$Conf{PingCmd} = '/bin/true';

$Conf{XferMethod} = 'tar';

# let it back itself up anytime it wants to.
$Conf{BlackoutPeriods} = [];

$Conf{TarShareName} = ['/'];

$Conf{BackupFilesExclude} = ['/proc', '/sys', '/var/lib/backuppc',
'/var/lib/vmware', '/var/log', '/tmp', '/var/tmp', '/mnt', '/media'];

$Conf{TarClientCmd} = '/usr/bin/env LC_ALL=C /usr/bin/sudo $tarPath -c -v -f
- -C $shareName --totals';

# remove extra shell escapes ($fileList+ etc.) that are
# needed for remote backups but may break local ones
$Conf{TarFullArgs} = '$fileList';
$Conf{TarIncrArgs} = '--newer=$incrDate $fileList';

# turning off compression on these files, so they can be recovered without
# backuppc.
# wouldn't make sense to need your backup server, 
# in order to recover your backup server, now would it?
$Conf{CompressLevel} = 0;


Note that this will also require a sudoers entry:
# allow backuppc to run as root, in order to get all the files
backuppc ALL=NOPASSWD: /bin/tar


> I also have a fairly large folder on the same server that I'd like to backup 
> with compression turned on.  Is it possible to split the localhost backup 
> into 2?  Can I create 2 hosts with the same name and exclude each other's 
> files and have one running with compression and one without?  Is there a 
> better way to do this?

Leaving aside the wisdom of storing backups on the same machine you're
backing up (I've done it, even tho I warned the client it was a bad idea),
yes it is possible to split the same machine into two different backups.
Here's an abbreviated example of how to do it for a remote networked
machine. The machine in this case is a Windows box.

# cat host.example.com.pl 
# split this into different backup profiles for the C drive and D drive 
# since we're having problems with those backups completing in time. 
# This is the C: drive backup

$Conf{XferMethod} = 'rsyncd';
$Conf{RsyncShareName} = ['cDrive'];
$Conf{RsyncdUserName} = 'rsyncbakup';
$Conf{RsyncdPasswd} = 'XXXXXXXXXXXXX';

<snip other options>

Here's the profile for backing up the D: drive on host.example.com:
# cat host-ddrive.example.com.pl 
# split this into different backup profiles for the C drive and D drive
# since we're having problems with those backups completing in time.
# This is the D: drive backup

$Conf{ClientNameAlias} = 'host.example.com';

$Conf{XferMethod} = 'rsyncd';
$Conf{RsyncShareName} = ['dDrive'];
$Conf{RsyncdUserName} = 'rsyncbakup';
$Conf{RsyncdPasswd} = 'XXXXXXXXXXXXX';

<snip other options>


You can also do this with a separate set of includes and excludes for each
backup profile.

For backing up Linux boxen I use ssh keys which are locked down to only run
a specific command. In order to have separate backup profiles for different
backups, I have separate users that BackupPC logs in as.

Here's the (trimmed) profile for backing up the OS, which logs in as the
user 'rsyncbakup2'::
# cat server-1.example.com-os.pl 
# logging into the same host as a differnent profile, 
# just using a different name for it in the BackupPC configuration
$Conf{ClientNameAlias} = '192.168.1.1';
$Conf{NmbLookupCmd} = '/bin/true';

# logging in as a different user 
# because there is a different set of directories to back up. 
# We're only backing up the OS-level stuff here.
$Conf{RsyncClientCmd} = '$sshPath -C -o Compression=no -c blowfish-cbc -q -x -l 
rsyncbakup2 $host $rsyncPath $argList+';


The profile for backing up /var/samba just takes the backup defaults, so it
doesn't have any of the settings specified above. It logs in as the user
'rsyncbakup' instead of 'rsyncbakup2'.

Here are the ssh key configurations (obviously not including the keys
themselves). The following has been cut into multiple lines for clarity, but 
*must* be all
one line on the server:
root@server-1# cat ~rsyncbakup/.ssh/authorized_keys
no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="sudo
/usr/bin/rsync --server --sender -logDtpr
--exclude-from=/var/lib/rsyncbakup/.ssh/backup-excludes
--include='/var/samba/' 
--exclude='/var/samba/example/example/*' 
--exclude='*.iso' --delete --numeric-ids --block-size=2048 . /" ssh-dss
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA<snip>

root@server-1# cat ~rsyncbakup2/.ssh/authorized_keys
no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="sudo
/usr/bin/rsync --server --sender -logDtpr --exclude='/var/samba/*'
--exclude='*.iso' --exclude='/proc/*' --exclude='/mnt/*'
--exclude='/sys/*' --exclude='/tmp/*' --exclude='/var/tmp/*'
--exclude='/var/cache/apt/archives/*' --exclude='/var/log/*' --delete
--numeric-ids --block-size=2048 . /" ssh-dss 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA<snip>


Hopefully this should provide you with some guidance as to how to set up
multiple backup profiles for the same host.

-- 
Carl Soderstrom
Systems Administrator
Real-Time Enterprises
www.real-time.com

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

<Prev in Thread] Current Thread [Next in Thread>