This guide will take you through how to backup Windows System with BackupPC using rsyncd.
In our previous guide, we learnt how to backup Windows system with BackupPC using Samba share (Server Message Block protocol). It is much safer to use Rsyncd for backup compared to using SMB.
Backing up Windows System with BackupPC Using Rsyncd
Assuming you have BackupPC server up and running, follow through this guide to backup your Windows system.
You can also follow the same steps for your GPU Dedicated Server or Azure Windows Virtual Desktop etc.
You can check the link below to setup a BackupPC server on Debian 10 Buster server.
Install and Configure BackupPC on Debian 10
Download and Install Cygwin Rsyncd
Since our BackupPC server uses Rsync protocol for backup, the only way we can install rsync on Windows is via the cygwin-rsyncd windows package.
Download Cygwin-Rsyncd installer from Releases page and and install it on your windows system.
Configure Rsyncd on Windows System
Cygwin-rsynd is installed under C:\rsyncd
. Within this directory are two major configuration files for rsyncd;
- the
rsyncd.secrets
which stores the username and password for backups. - the
rsyncd.conf
, which is the main configuration file for Rsync containing the files and directories to be backed up.
Open the C:\rsyncd\rsyncd.secrets
and set the username and password in the format, username:password
. Note that the file should end in a newline. Otherwise the last username/password pair will be ignored.
# You also need to put your client-specific BackupPC user name in the
# "auth users" setting in the c:/rsyncd/rsyncd.secrets file.
#
# On the BackupPC server, in the configuration for this client:
# - $Conf{RsyncdUserName} should be set to whatever you replace UUU with
# You also needs to update "auth users" in the
# c:/rsyncd/rsyncd.secrets file.
# - $Conf{RsyncdPasswd} should be set to whatever you replace PPP with
# - $Conf{XferMethod} should be set to "rsyncd"
# - $Conf{RsyncShareName} should be set to "cDrive", or whatever shares
# you created in the c:/rsyncd/rsyncd.secrets file.
#
# SECURITY WARNING: Don't just uncomment the last line and use the defaults
# of UUU for the user name and PPP for the password! Change them!!
#
# Also: make sure this file ends in a newline. Otherwise the last
# username/password pair will be ignored.
#
#UUU:PPP
backuppc:password
Next, edit the C:\rsyncd\rsyncd.conf
and configure the files and directories to backup.
Before you can proceed, make a copy of the configuration file.
Next, create a backup share defining the directory to backup, the backup username, the credentials file, IP of the BackupPC server.
[MyDocuments]
path = /cygdrive/c/Users/koromicha/Documents
comment = My Documents
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 = 192.168.56.117
# Allows restores to write to this share
read only = false
list = false
# git issue : https://github.com/backuppc/backuppc/issues/116
charset=utf-8
Save the configuration file and restart Rsyncd service by navigating to Task Manager -> Services -> RsyncServer. Right click it and restart the service.
If Windows firewall is running, allow Ping and TCP port 873.
To allow Ping, open Windows Firewall with Advanced Security > Inbound Rules and enable ping for Public, Domain, and Private profiles for File and Printer Sharing IPv4.
To allow TCP port 873, click on New rule > Port > TCP > Specific local port (873) > Allow Connections > (Allow connections for Domain and Private profiles). Set the name of the rule and finish it.
Testing Connection to Windows System
Next, you need to test whether you can connect to your host. Hence, login to your BackupPC server as backuppc user and run the connection test.
This can be done using the rsync command as shown below;
su - backuppc
rsync [email protected]::MyDocuments
Where;
backuppc
is the user defined in the ryncd configuration file by the auth users parameter.192.168.56.122
is the IP address of the Windows host.MyDocuments
is the Share name defined in the rsyncd configuration file above.
If the connection is successful, you should get a password prompt. When you enter the password, you will see a list of all files and directories under you share.
Password:
file has vanished: "/proc" (in MyDocuments)
drwxr-x--- 0 2019/09/21 21:03:07 .
-rwxr-x--- 17,489 2018/03/07 10:03:00 ADA L7-report.xlsx
-rwxr-x--- 17,013 2018/03/07 10:32:56 ADA User activity report.xlsx
-rwxr-x--- 16,991 2018/03/07 10:11:36 Acc created.xlsx
-rwxr-x--- 11,398 2019/01/16 15:56:09 Book2.xlsx
-rwxr-x--- 188,764 2018/03/28 17:21:08 ads.pdf
-rwxr-x--- 2,048 2019/05/22 09:13:18 Default.rdp
-rwxr-x--- 867 2018/02/06 13:04:07 DeviceofferAccountCreated_RightsInfoChnaged.txt
-rwxr-x--- 31,370 2018/03/28 10:20:36 Document3.pdf
...
Add Windows Host to BackupPC
After the above configuration, login to BackupPC web interface and add your Windows host system and the user for backups.
su - backuppc
echo "192.168.56.122 0 backuppc" >> /etc/backuppc/hosts
Next, create the Host configuration file based on whether you are using hostnames or IP addresses. For example, to create the configuration file for the host above;
vim /etc/backuppc/pc/192.168.56.122.pl
Now, set the Share Name to backup (MyDocuments), the protocol to use (rsyncd), directories or files to exclude if any. Also, the backup user and password. See the sample configuration file below;
$Conf{BackupFilesExclude} = {
'MyDocuments' => [
'/*.mp4',
'/*.mp3'
]
};
$Conf{RsyncShareName} = [
'MyDocuments'
];
$Conf{RsyncdPasswd} = 'password';
$Conf{RsyncdUserName} = 'backuppc';
$Conf{XferMethod} = 'rsyncd';
Once you have added your Windows host, restart backuppc service.
systemctl restart backuppc
Next, login to BackupPC user interface and confirm the settings.
Running Backup
Once done with the configuration, you can now run the system backup. Select the host and under Backup Summary page > User Actions, click Start Full Backup.
You can check the LOG files to see if there is any issue with backup.
Based on the above logs, the backup was successful. CLick browse backups to see the files and directories backed up.
You have successfully backup the data from you Windows host. This marks the end of our guide.
Related Tutorials
How to Install and Configure BackupPC as a Backup Server on Ubuntu 18.04
Exactly what I needed; thanks!
Which of these are true, regarding BackUpPC, and trying to backup W10 files:
You can backup a small group of individual files.
You can backup an entire folder and everything inside.
You can backup an entire partial C:\
You can backup many partitions: C:\ and D:\ and E:\
You can backup the entire drive (all partitions) bare metal
You can backup all the drives, all partitions on all of them