Archive for the ‘BackupPC’ Category

Windows backup with BackupPC

In my last post I explained how BackupPC is installed on a fresh openSuse 13.1 machine. Now it is time to setup a backup of a windows machine.

Defining hosts

Each host that has to be backuped has to be defined in the /etc/BackupPC/hosts file. As I will be using DHCP you have to put there the real host name (I will be using myhost). Add this line to the end of the hosts file:

myhost 1

The first parameter is the host name, and the second is the using DHCP flag.
To be sure this will work issue the following command on the prompt:

nmblookup -A X.Y.Z.W

Where X.Y.Z.W is the current IP of the myhost. You should get some lines like this back:

Looking up status of X.Y.Z.W

To define specific backup options for that host create a file named in /etc/BackupPC/pc/. In my case it is /etc/BackupPC/pc/ . The content of the file is the following:
$Conf{XferMethod} = 'rsyncd';
$Conf{RsyncdUserName} = 'backuppc';
$Conf{RsyncdPasswd} = 'backuppc';
$Conf{RsyncShareName} = 'backup_folder';

I will be using rsyncd transfer method because it is the fastest one. The username/password I will configure on the myhost will be backuppc/backuppc and I will setup a share named backup_folder there.

We are still not done because BackupPC doesn’t know how to find the host by it’s name. It has to scan a IP range to find it first. To setup the IP range open the /etc/BackupPC/ file and find the $Conf{DHCPAddressRanges} parameter. You can setup multiple ranges, but I need only one. I will use real numbers in this example:

$Conf{DHCPAddressRanges} = [
            ipAddrBase => '192.168.1',
            first => 21,
            last  => 200,

This will scann all IPs from to and check the hostname it gets back with the one you defined. It is a nice feature if you have an ADSL router with DHCP which changes your host IP address every time you ask a new lease.

You can now reload the configuration with:

service backuppc reload

Installation on the windows machine

The rsync daemon/service has to be installed on the windows machine. The easiest way is to use the one from the BackupPC repository. The current is this one. Once installed open the c:\rsyncd\rsyncd.conf and setup a share like this:

path = /cygdrive/c/Users/
comment = Users folder
strict modes = false
# Limit this share to just these users (needs to match $Conf{RsyncdUserName}
# and the c:/rsyncd/rsyncd.secrets files)
auth users = backuppc
# Password to match $Conf(RsyncdPasswd)
secrets file = c:/rsyncd/rsyncd.secrets
# List the IP address(es) of your BackupPC server(s), so only connections from these hosts will be allowed.
hosts allow =
# Allows restores to write to this share
read only = true
list = true

This will backup the Users folder which is usually the most important folder people put stuff in. The name in square brackets must match the one defined in the file. Multiple shares can be defined, with different options for each one. This one is readonly, accessible for user backuppc and limited to the local network ( Remember to use foward slashes in this file and that the path mapping of folders is linux-like (c:\ is /cygdrive/c/).

The password for the backuppc user is setup in the c:\rsyncd\rsync.secrets file. Add the following line at the end of that file:


And be sure to add an empty line at the end.
You can restart the RsyncServer service with a right click on My Computer -> Manage -> Services and Application -> Services -> Rsync Server (right click) -> Restart

Go, go, go…

You are done. The first full backup will occur at the time specified in the BackupPC config file (20:00, from the last post).

Installing BackupPC on openSuse 13.1

29/12/2013 1 comment

I was trying to install BackupPC on my fresh openSuse 13.1 install. There was no package for openSuse so I used the documentation from the original site.


The missing prerequsite for perl is File::RsyncP which you can install from repository in version 0.43, or use the newer one from Sourceforge in version 0.68. I like being on the bleeding edge (0.43 is from 2003, and 0.68 is from 2006) and actually BackupPC states that it needs at least 0.68.

tar -xvf File-RsyncP-0.68.tar.gz
cd File-RsyncP-0.68
perl Makefile.PL

Error 1:
Make is missing so I have to install that also.

Fix 1:
zypper install make

Continuing the installation of File::RsyncP.

Error 2:
GCC is missing so I have to install that also.

Fix 2:
zypper install gcc

Continuing the installation of File::RsyncP.
make install

There were some warnings, but the tests passed OK, so I think this will work just fine.

Creating a dedicated user and group

For security reasons a dedicated user and group should be used for running BackupPc.

useradd -d /home/backuppc -c 'BackupPC user' -U -r -M backuppc
mkdir /home/backuppc
chown -R backuppc:backuppc /home/backuppc

Getting and installing BackupPC 3.3.0

The source can be downloaded from Sourceforge and the installation is trivial.

tar -xvf BackupPC-3.3.0.tar.gz
cd BackupPC-3.3.0

Now is the time to answer some questions:

  1. Full path to existing main – leave empty
  2. Are these paths correct? – yes
  3. BackupPC will run on host [your_host_name]? – acknowledge the default
  4. BackupPC should run as user [backuppc]? – use the default
  5. Install directory (full path) – /opt/BackupPC
  6. Data directory (full path) – /home/backuppc/data
  7. Compression level [3]? – user default
  8. CGI bin directory (full path) – /srv/www/cgi-bin
  9. Apache image directory (full path) – /srv/www/htdocs/BackupPC
  10. URL for image directory (omit http://host; starts with ‘/’) – /BackupPC
  11. Do you want to continue? – yes

Now that BackupPC is installed, in needs to be configured. So open /etc/BackupPC/ and configure it:

$Conf{WakeupSchedule} = [20];
$Conf{FullKeepCnt} = [4, 0, 4];
$Conf{IncrLevels} = [1, 2, 3, 4, 5, 6];
$Conf{CgiAdminUsers} = 'your_username';

Run every day at 20:00, have 5 months of full backups (4 * 1 week + 4 * 1 month), create 6 incremental backups between full backups (every day between the weekly full backup), and setup a user as admin.

Acording to this article, the default init script is not good so another one should be used. As that script is also broken, you can use the following:

# /etc/init.d/backuppc
# Provides: backuppc
# Required-Start: $local_fs $remote_fs $network
# X-UnitedLinux-Should-Start:
# Required-Stop: $local_fs $remote_fs $network
# X-UnitedLinux-Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: BackupPC - High End Archive Server
# Description: Start the BackupPC daemon


set -e


test -x $BINDIR/$DAEMON || exit 0

case "$1" in
echo -n "Starting $NAME: "
startproc -p $LOGDIR/ -u $USER $BINDIR/$DAEMON -d
echo "ok."
echo -n "Stopping $NAME: "
echo "ok."
$0 stop
$0 start
echo "Reloading $NAME configuration files"
echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload}"
exit 1

exit 0

After that register the service with this command:

install -m 0755 backuppc /etc/init.d/

Go, go, go…

Run the service with:

service backuppc start

And that’s it. Now, to configure clients and Nginx you will have to wait for the next article.