Table of Contents

BackupPC

BackupPC is a very powerful backup system run on the server machine. You find all the necessary documentation on http://backuppc.sourceforge.net, including configuration instructions.

Documentation

Important!

BackupPC will abort when trying to backup a named pipe. Check the linux client with:

find / -type p -print

rsync needs to be installed on the client:

apt-get install rsync

After that, check whether the path to rsync on the client is the same as on the backuppc server. If it's not, change the clients config file (example: synology.pl):

$Conf{RsyncClientPath} = '/usr/syno/bin/rsync';

Hardware configuration

To optimize performance in the virtual machine, attach the physical drive which contains the backup data directly to the virtual machine. The example below attaches an LVM drive to the virtual machine. Steps:

  1. Do not mount /backup on the physical machine, remove the respective mount instruction in fstab.
  2. Create the physical disk information with VBoxManage on the physical machine and attach the drive as second harddrive to the vm.
  3. Boot the vm and add the mount information to fstab of the vm.
user@apollo: VBoxManage internalcommands createrawvmdk -filename "/home/bco/VirtualBox VMs/Chiron/backup.vmdk" -rawdisk /dev/mapper/vg_backup-lv_backup
root@chiron: ls -la /dev/disk/by-uuid >> /etc/fstab
root@chiron: vim /etc/fstab

Installation

apt-get install backuppc

Take a note of the pre-assigned password <pwd> during the run of the installation script

Changing Password

Creating or initializing the password file:

htpasswd -c /etc/backuppc/htpasswd backuppc

Adding users to backuppc to access the CGI interface:

htpasswd /etc/backuppc/htpasswd <user>

To disable authentication, comment the auth instructions in /etc/backuppc/apache.conf and restart backuppc and apache.

Main Configuration

If you do not install BackupPC on a machine which's sole purpose is to backup data, you should move the target data space to a separate mount point or even a separate harddisk.

cd /var/lib
mv backuppc /backup  # move the content as set up by the installer to a separate mount point, e.g. /backup
ln -s /backup/backuppc backuppc  # create a symlink so all the default paths are maintained

:!: If you install and run BackupPC on a machine with Gnome desktop running, you need to exclude ~/.gvfs from the backup path to avoid the task aborting when trying to access the path (see config file below) :!:

Check whether a client is accessible

First, access the client manually with the following command:

ssh -p <port> <client>

You need to login to the client via SSH at least once manually to accept the host key.

Make sure, that sshd_config on the client includes the following line:

PermitRootLogin without-password

Run the following command:

nmblookup host

Off-schedule cleanup of backup data

/usr/share/backuppc/bin/BackupPC_nightly 0 255 

Client configuration - Global settings

Details how to setup clients for backup are found in the documentation. Following are example config files and some hints for different types of clients.

Find important global settings which differ from the default below.

Global config: config.pl

# Global config
# run nightly cleanup at 3am, run backups between 4am and 4pm and at 9pm
$Conf{WakeupSchedule} = [3..16, 21];

# Smbclient share user name.  This is passed to smbclient's -U argument.
$Conf{SmbShareUserName} = '<smb_user>';
$Conf{SmbSharePasswd} = '<pwd>';

# Minimum period of 7 days between full and incremental backups
$Conf{FullPeriod} = 6.97;
$Conf{IncrPeriod} = 0.97;

# Remove full backups after <FullAgeMax> days but keep at least <FullKeepCntMin>
$Conf{FullKeepCntMin} = 1;
$Conf{FullAgeMax}     = 90;

# Keep <IncrKeepCnt> incremental backups
$Conf{IncrKeepCnt} = 30;

# Remove full backups after <IncrAgeMax> days but keep at least <IncrKeepCntMin>
$Conf{IncrKeepCntMin} = 3;
$Conf{IncrAgeMax}     = 30;

# For clients which are regularly online specify blackout periods
# when no backups will be started
$Conf{BlackoutPeriods} = [
    { # weekdays
      hourBegin =>  9.0,
      hourEnd   => 23.0,
      weekDays  => [1, 2, 3, 4, 5],
    },
    { # weekend
      hourBegin => 12.0,
      hourEnd   => 23.0,
      weekDays  => [0, 6],
    },
];

# Only increase the ping time if you need to access a client outside your LAN
$Conf{PingMaxMsec} = 20;

# Timeout in seconds when listening for the transport program's
# (smbclient, tar etc) stdout. If no output is received during this
# time, then it is assumed that something has wedged during a backup,
# and the backup is terminated.
$Conf{ClientTimeout} = 43200; # 12 hours

Client configuration - Windows

Accessing the client

Although BackupPC allows to access clients with the Samba protocoll, I chose to set up AutoFS and make all shares accessible through mount points. AutoFS also uses the samba file system to access the shares. Advantages:

Configuration script for Windows clients

#
# Titan - BackupPC settings
# shares are mounted through autofs
#
$Conf{XferMethod} = 'rsync';
$Conf{RsyncShareName} = ['/mnt/titan/C', '/mnt/titan/D', '/mnt/titan/E'];
$Conf{BackupFilesExclude} =  ['$Recycle.Bin', '$RECYCLE.BIN', 'RECYCLER',
     'System Volume Information', 'pagefile.sys', 'hiberfil.sys',
     'Documents and Settings', 'Recovery', 'VirtualBox VMs', 'temp',
     'HandBrake', 'MakeMKV', 'TrueImage', 'Images', 'Games', 'Downloads',
     'Recovery', 'MSOCache', '*.iso', '*.ISO', '_*'];
$Conf{RsyncClientCmd} = '$rsyncPath $argList';
$Conf{RsyncClientRestoreCmd} = '$rsyncPath $argList';

Client configuration - Linux

Accessing the client

Prepare the following to access the client:

# visudo
%sudo ALL=(ALL:ALL) ALL
backuppc ALL=NOPASSWD: /usr/bin/rsync

Configuration script for Linux clients

#
# Taurus - BackupPC settings
#
$Conf{XferMethod} = 'rsync';
$Conf{RsyncShareName} = ['/etc', '/root', '/home', '/usr/local', '/var/www/'];
$Conf{RsyncClientCmd} = '$sshPath -p 22 -q -x -l root $host $rsyncPath $argList';
$Conf{RsyncClientRestoreCmd} = '$sshPath -p 22 -q -x -l root $host $rsyncPath $argList';
$Conf{BackupFilesExclude} = ['*.vdi', '.gvfs', 'lost+found', 'Downloads'];

Configuration script for Linux localhost

#
# Chiron (localhost) - BackupPC settings
#
$Conf{XferMethod} = 'rsync';
$Conf{RsyncShareName} = ['/etc', '/root', '/home', '/usr/local', '/var/www/'];
$Conf{RsyncClientCmd} = '/usr/bin/sudo $rsyncPath $argList';
$Conf{RsyncClientRestoreCmd} = '/usr/bin/sudo $rsyncPath $argList';
$Conf{BackupFilesExclude} = ['*.vdi', '.gvfs', 'lost+found', 'Downloads'];