Complete rsnapshot Backup Guide: Linux, Windows Shares, NAS, and Samba

Starting with the essential rsnapshot commands, this guide explains how to back up local Linux directories, pull data from remote Linux systems over SSH, mount Windows, NAS, and Samba shares, build daily, weekly, and monthly snapshots, and troubleshoot permissions, mounts, and scheduled jobs.

rsnapshot is well suited to keeping directly browsable historical versions on a Linux backup server. It synchronizes data with rsync and reuses unchanged files through hard links.

As a result, daily.0, daily.1, and weekly.0 each look like complete backups, while unchanged files normally consume storage only once. Recovery requires no proprietary database: locate the required snapshot and copy the files.

This article is organized into four categories of sources:

  1. Linux native directory;
  2. Remote Linux directory accessed via SSH;
  3. Windows or Samba share;
  4. NAS serving files via SMB/CIFS or NFS.

All examples write snapshots to:

1
/mnt/backup/rsnapshot/

Before you begin, replace the example IP addresses, usernames, share names, and directories with values from your environment.

rsnapshot Features and Essential Commands

How rsnapshot Moves Data

The most common deployment method is to have a Linux machine act as a backup server:

1
2
3
Linux 本机目录 ───────────────┐
远程 Linux ── SSH + rsync ────┼──> rsnapshot 快照根目录
Windows/NAS ── SMB 或 NFS ────┘

The backup server reads source data, writes snapshots, runs scheduled jobs, and records logs. For remote Linux systems, rsnapshot actively pulls data over SSH. Windows and NAS shares are usually mounted on Linux first and then backed up as local directories.

rsnapshot is not a real-time synchronization tool, nor is it an off-site backup strategy itself. It can reduce the cost of recovery by accidental deletion, accidental modification, and when historical versions are needed, but it cannot replace offline copies, off-site copies, and recovery drills.

Install the Required Packages

Ubuntu or Debian can install:

1
2
sudo apt update
sudo apt install -y rsnapshot rsync openssh-client cifs-utils nfs-common

Each package has a specific role:

  • rsnapshot: manages synchronization and snapshot rotation;
  • rsync: copies changed data;
  • openssh-client: connect to remote Linux;
  • cifs-utils: mounts SMB shares from Windows, Samba, and common NAS systems;
  • nfs-common: mounts NFS exports from a NAS.

Confirm command location:

1
2
3
command -v rsnapshot
command -v rsync
command -v ssh

The examples in this article use /usr/bin/rsnapshot, /usr/bin/rsync, and /usr/bin/ssh. If your system reports different paths, use the paths it returns.

Verify the Backup Disk First

Create the snapshot root directory:

1
2
3
sudo mkdir -p /mnt/backup/rsnapshot
df -Th /mnt/backup/rsnapshot
findmnt -T /mnt/backup/rsnapshot

The snapshot root should be on a Linux file system that supports hard links, such as ext4 or XFS. Do not put it directly into file systems such as FAT, exFAT, etc. that do not support Unix hard links.

If /mnt/backup is an independent hard disk, also confirm that it is indeed mounted. Otherwise, after the disk mounting fails, the task may write the backup into an empty directory with the same name on the system disk.

You can do a hard link test first:

1
2
3
4
sudo sh -c 'echo test > /mnt/backup/rsnapshot/.link-test'
sudo ln /mnt/backup/rsnapshot/.link-test /mnt/backup/rsnapshot/.link-test-2
ls -li /mnt/backup/rsnapshot/.link-test*
sudo rm /mnt/backup/rsnapshot/.link-test /mnt/backup/rsnapshot/.link-test-2

Both test files should have the same inode number.

Core Configuration File Structure

The main configuration is usually /etc/rsnapshot.conf:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
config_version	1.2

snapshot_root	/mnt/backup/rsnapshot/

cmd_cp	/usr/bin/cp
cmd_rm	/usr/bin/rm
cmd_rsync	/usr/bin/rsync
cmd_ssh	/usr/bin/ssh
cmd_du	/usr/bin/du

retain	daily	7
retain	weekly	4
retain	monthly	6

The Tab character must be used between configuration items and parameters. The code block display width may differ from the editor, the actual characters should be checked after pasting, and a string of ordinary spaces should not be used instead of Tab.

This set of retention policies represents:

  • Save 7 daily snapshots;
  • Save 4 weekly snapshots;
  • Save 6 monthly snapshots.

In the default mode, the most frequent level, daily, performs the actual rsync transfer and rotates daily snapshots. weekly and monthly primarily promote older snapshots from lower levels. Enabling sync_first 1 changes this behavior, so the schedule shown here no longer applies unchanged.

Essential Commands

Check the configuration syntax:

1
sudo rsnapshot configtest

Normal results should contain:

1
Syntax OK

Preview the command without actually backing up:

1
sudo rsnapshot -t daily

To perform a daily sync:

1
sudo rsnapshot daily

View snapshot disk usage:

1
2
sudo rsnapshot du
df -h /mnt/backup/rsnapshot

Use a custom configuration file:

1
2
3
sudo rsnapshot -c /home/test/rsnapshot.conf configtest
sudo rsnapshot -c /home/test/rsnapshot.conf -t daily
sudo rsnapshot -c /home/test/rsnapshot.conf daily

If the job runs as the unprivileged user test, the checks, SSH keys, and directory permissions must all use that same account:

1
2
3
sudo -u test -H rsnapshot -c /home/test/rsnapshot.conf configtest
sudo -u test -H rsnapshot -c /home/test/rsnapshot.conf -t daily
sudo -u test -H rsnapshot -c /home/test/rsnapshot.conf daily

Back Up Linux Directories

Back Up Local Directories

Assume that the following directories are backed up:

1
2
3
/etc/
/home/
/srv/www/

Add in /etc/rsnapshot.conf:

1
2
3
backup	/etc/	localhost/
backup	/home/	localhost/
backup	/srv/www/	localhost/

When global rsync_long_args contains --relative, the source’s directory hierarchy is preserved and the result is usually similar to:

1
2
3
/mnt/backup/rsnapshot/daily.0/localhost/etc/
/mnt/backup/rsnapshot/daily.0/localhost/home/
/mnt/backup/rsnapshot/daily.0/localhost/srv/www/

Execute first:

1
2
sudo rsnapshot configtest
sudo rsnapshot -t daily

Carefully check the source path and target path in the dry-run output to confirm that the wrong location is not written before officially executing:

1
2
sudo rsnapshot daily
sudo find /mnt/backup/rsnapshot/daily.0/localhost -maxdepth 3 -type d | head -50

Back Up Remote Linux Systems over SSH

The hypothetical environment is as follows:

1
2
3
4
备份服务器:当前安装 rsnapshot 的 Ubuntu
远程服务器:192.168.1.50
远程用户:backupuser
远程目录:/data/files/

The remote machine usually does not have to have rsnapshot installed, but it must have an SSH service running and rsync in the remote environment.

First confirm on the remote machine:

1
command -v rsync

If rsnapshot is run by root’s cron, configure SSH keys for root:

1
2
3
sudo ssh-keygen -t ed25519
sudo ssh-copy-id [email protected]
sudo ssh [email protected]

The last command must enable direct login and cannot require a password or host key confirmation.

If the task is run by user test:

1
2
3
sudo -u test -H ssh-keygen -t ed25519
sudo -u test -H ssh-copy-id [email protected]
sudo -u test -H ssh [email protected]

Configure backup point:

1
backup	[email protected]:/data/files/	remote-linux/

Then verify in sequence:

1
2
3
4
sudo rsnapshot configtest
sudo rsnapshot -t daily
sudo rsnapshot daily
ls -lah /mnt/backup/rsnapshot/daily.0/remote-linux/

If --relative is used, the data/files layer may be retained in the snapshot. This is not a duplicate backup, but rsync’s relative path behavior.

Control the Remote Directory Layout in Snapshots

If you want the content in /data/files/ to appear directly under remote-linux/, you can use /./ to mark the relative path starting point:

1
backup	[email protected]:/data/files/./	remote-linux/

The backup result will be closer to:

1
2
/mnt/backup/rsnapshot/daily.0/remote-linux/项目A/
/mnt/backup/rsnapshot/daily.0/remote-linux/项目B/

Path semantics are easily affected by trailing slashes and --relative, so don’t rely solely on expectations. rsnapshot -t daily should be run first, and then rsync dry-run directly if necessary.

Use a Nonstandard SSH Port

When the remote SSH port is 2222, you can write in the global configuration:

1
2
cmd_ssh	/usr/bin/ssh
ssh_args	-p 2222

Test manually first:

1
ssh -p 2222 [email protected]

If only one server uses a special port, it is recommended to use ~/.ssh/config instead to avoid global ssh_args affecting other backup points:

1
2
3
4
5
Host server50-backup
    HostName 192.168.1.50
    User backupuser
    Port 2222
    IdentityFile ~/.ssh/id_ed25519

The corresponding configuration is:

1
backup	server50-backup:/data/files/	remote-linux/

Back Up Multiple Linux Hosts

Use separate target names for each source:

1
2
3
backup	[email protected]:/data/files/	server50-files/
backup	[email protected]:/home/	server50-home/
backup	[email protected]:/srv/www/	server60-www/

In this way, you can immediately see which machine the data came from during recovery, and can also prevent different sources from writing to the same directory.

Back Up Only Bare .git Repositories at the Source Root

Assume the directory on the NAS is:

1
2
3
4
5
6
7
/volume1/homes/git/
├── vuepress_sites.git/
├── zcb.git/
├── zyys_book_v2.git/
├── website/
├── test/
└── README.txt

Only keep the directories ending with .git in the root directory and their entire contents:

1
backup	[email protected]:/volume1/homes/git/./	git/	+rsync_long_args=--rsync-path=/usr/bin/rsync --include=/*.git/*** --exclude=*

Use Tabs for the first three separators, and use normal spaces for the rsync parameters in the fourth column. +rsync_long_args= means appending to global parameters instead of replacing them as a whole.

The order of filter rules cannot be reversed. rsync determines whether to include the object based on the first matching rule, so --include=/*.git/*** must be in front of --exclude=*.

First test rsync directly:

1
2
3
4
5
6
7
/usr/bin/rsync -avhn \
  --relative \
  --rsync-path=/usr/bin/rsync \
  '--include=/*.git/***' \
  '--exclude=*' \
  [email protected]:/volume1/homes/git/./ \
  /tmp/git-backup-test/

The .git directory and its contents should appear in the output; website/, test/, or README.txt should not appear.

If the rule is later changed from “Backup All” to “Backup Only .git”, other content in the old snapshot will not disappear from the historical snapshot. For the new daily.0 to clean excluded objects, the impact of --delete-excluded needs to be understood and tested; it may delete data in the target that no longer matches filtering rules and cannot be enabled directly without dry-run verification.

Back Up Remote Windows Shares, NAS, and Samba Directories

Choose Between SMB, NFS, and SSH

You can choose according to source capabilities:

  • Windows file sharing: typically uses SMB/CIFS;
  • Samba server: usually uses SMB/CIFS, or directly via SSH + rsync;
  • NAS such as Synology and QNAP: You can use SMB/CIFS, NFS, or SSH + rsync in a controlled environment;
  • Remote Windows with OpenSSH and WSL rsync configured: Pulling via SSH is possible, but deployment and path handling are more complex.

For ordinary Windows shares, the easiest way to maintain is to mount them read-only on Linux first, and then let rsnapshot backup the mount point.

Create an SMB Credentials File

Do not write the password directly in /etc/fstab or in the command history. Create a credentials file readable by root:

1
2
sudo install -m 600 /dev/null /root/.smb-backup-credentials
sudo nano /root/.smb-backup-credentials

The content is:

1
2
3
username=backupuser
password=替换为真实密码
domain=WORKGROUP

If you do not use the domain, delete the domain line. Confirm permissions again:

1
sudo stat -c '%a %U:%G %n' /root/.smb-backup-credentials

Expected permissions are 600 root:root.

Mount a Windows or Samba Share Manually

Assume the shared address is //192.168.8.100/files:

1
2
3
sudo mkdir -p /mnt/source/windows-files
sudo mount -t cifs //192.168.8.100/files /mnt/source/windows-files \
  -o ro,credentials=/root/.smb-backup-credentials,vers=3.0

Verify mount and read:

1
2
findmnt -T /mnt/source/windows-files
sudo ls -lah /mnt/source/windows-files | head

First confirm that the share can be read stably before writing the rsnapshot configuration. If manual mounting fails, rsnapshot will not resolve authentication, protocol, or network issues.

Configure Automatic Mounting at Boot

Add a line to /etc/fstab:

1
//192.168.8.100/files /mnt/source/windows-files cifs ro,credentials=/root/.smb-backup-credentials,vers=3.0,_netdev,nofail 0 0

Do not restart directly when testing:

1
2
3
sudo umount /mnt/source/windows-files
sudo mount -a
findmnt -T /mnt/source/windows-files

Among them:

  • ro: Mount in read-only mode to reduce the risk of the backup machine accidentally changing the source data;
  • credentials=: Read account password from independent file;
  • vers=3.0: Explicitly try SMB 3.0;
  • _netdev: Mark this as a network-dependent mount;
  • nofail: Does not prevent the system from continuing to start when the mount fails.

nofail only affects startup behavior and does not mean that backup tasks should ignore mount failures. The mount status must still be checked before scheduled backup.

Add the SMB Mount Point to rsnapshot

Configuration:

1
backup	/mnt/source/windows-files/	windows-files/

Then verify:

1
2
3
4
sudo rsnapshot configtest
sudo rsnapshot -t daily
sudo rsnapshot daily
ls -lah /mnt/backup/rsnapshot/daily.0/windows-files/

Don’t just check if the directory exists. Even if the SMB mount is down, the local mount point directory may still exist, but be empty.

Mount an NFS Export from a NAS

Assume the NAS exports 192.168.8.200:/volume1/files:

1
2
3
4
sudo mkdir -p /mnt/source/nas-files
sudo mount -t nfs -o ro 192.168.8.200:/volume1/files /mnt/source/nas-files
findmnt -T /mnt/source/nas-files
sudo ls -lah /mnt/source/nas-files | head

Corresponding to /etc/fstab example:

1
192.168.8.200:/volume1/files /mnt/source/nas-files nfs ro,_netdev,nofail 0 0

rsnapshot configuration:

1
backup	/mnt/source/nas-files/	nas-files/

NFS has a different user mapping and permissions model than SMB. Being able to mount does not mean being able to read all files. You should use the account that actually runs rsnapshot to recursively check the directory.

Prevent Empty Snapshots When a Share Goes Offline

The simplest cron protection is to first check all necessary mount points:

1
2
3
/usr/bin/mountpoint -q /mnt/source/windows-files && \
/usr/bin/mountpoint -q /mnt/source/nas-files && \
/usr/bin/rsnapshot daily

If any mount point does not exist, rsnapshot will not execute.

You can also check for a sentinel file that only exists on the share:

1
2
3
test -r /mnt/source/windows-files/.backup-source-ok && \
test -r /mnt/source/nas-files/.backup-source-ok && \
/usr/bin/rsnapshot daily

The sentinel file can detect problems such as “the mount point exists but the wrong share is mounted”. The file should be created by the source administrator and must be readable by the backup account.

Schedule Backups and Rotate Snapshots

Assume the configuration is:

1
2
3
retain	daily	7
retain	weekly	4
retain	monthly	6

Editable root’s crontab:

1
sudo crontab -e

Write:

1
2
3
4
5
6
7
8
# 每月 1 日 03:00
0 3 1 * * /usr/bin/rsnapshot monthly >> /var/log/rsnapshot.log 2>&1

# 每周日 03:30
30 3 * * 0 /usr/bin/rsnapshot weekly >> /var/log/rsnapshot.log 2>&1

# 每天 04:00
0 4 * * * /usr/bin/rsnapshot daily >> /var/log/rsnapshot.log 2>&1

When actually writing to the crontab, do not add a backslash before the asterisk.

The high-level rotation is scheduled before daily synchronization so that monthly and weekly receive snapshots that are about to be phased out from lower levels first. When the 1st of every month happens to be a Sunday, the execution sequence is monthly, weekly, daily.

Use One Lock Across All Retention Levels

When the disk is slow, there are many files, or the network is unstable, a daily may run until the scheduled weekly time. Use flock to prevent overlap:

1
2
3
0 3 1 * * /usr/bin/flock -n /run/lock/rsnapshot.lock /usr/bin/rsnapshot monthly >> /var/log/rsnapshot.log 2>&1
30 3 * * 0 /usr/bin/flock -n /run/lock/rsnapshot.lock /usr/bin/rsnapshot weekly >> /var/log/rsnapshot.log 2>&1
0 4 * * * /usr/bin/flock -n /run/lock/rsnapshot.lock /usr/bin/rsnapshot daily >> /var/log/rsnapshot.log 2>&1

-n means to exit immediately if the lock cannot be obtained. This will not start two rsnapshots at the same time, but it must be combined with log monitoring to prevent tasks from being skipped due to lock conflicts in the long term.

If SMB and NFS mounts must be checked before daily, it is recommended to write a wrapper script that is owned by root and cannot be modified by ordinary users, and then called by cron. Don’t stack long compound commands in crontab.

Validate the Setup Before Enabling Scheduled Jobs

Complete in order:

1
2
3
4
5
sudo rsnapshot configtest
sudo rsnapshot -t daily
sudo rsnapshot daily
sudo find /mnt/backup/rsnapshot/daily.0 -maxdepth 3 -type d | head -100
sudo tail -100 /var/log/rsnapshot.log

Also make sure that the root used by cron can connect to each remote Linux without interaction:

1
2
sudo ssh [email protected] true
sudo ssh [email protected] true

The command should return success directly and should not wait for password or first connection confirmation.

After taking two consecutive snapshots, select an unchanged file:

1
2
ls -li /mnt/backup/rsnapshot/daily.0/localhost/etc/hosts
ls -li /mnt/backup/rsnapshot/daily.1/localhost/etc/hosts

If the inodes are the same and the hard link count is greater than 1, it means that the two snapshots share the same file data.

Do not use the simple addition of du -sh daily.0 daily.1 to estimate the true additional space. Hard links will make per-directory statistics appear as if each snapshot occupies a full capacity.

Restore Files

Browse historical snapshots before restoring:

1
2
ls -lah /mnt/backup/rsnapshot/daily.1/remote-linux/
ls -lah /mnt/backup/rsnapshot/weekly.0/windows-files/

Restore files to a temporary directory:

1
2
3
mkdir -p /tmp/rsnapshot-restore
cp -a /mnt/backup/rsnapshot/daily.1/remote-linux/data/files/report.pdf \
  /tmp/rsnapshot-restore/

Inspect the recovered files before deciding whether to overwrite the production directory. When restoring to a remote server, rsync to a temporary location first and have the administrator or data owner verify permissions, ownership, and contents.

Common Problems and Troubleshooting

configtest Reports an Error or an Invalid Field Count

The most common cause is that Tabs are replaced with spaces. Show invisible characters:

1
sed -n '1,120l' /etc/rsnapshot.conf

Tab usually appears as \t. Correct the file and run the check again:

1
sudo rsnapshot configtest

Also check that the command path actually exists and that snapshot_root is readable and writable.

Permission denied (publickey)

This means that the local account executing the task cannot log in via SSH keys. Test with the same account:

1
sudo -u test -H ssh -vv [email protected] true

Check the following items:

  • Whether the public key is added to ~/.ssh/authorized_keys of the remote account;
  • Whether the local private key belongs to the account running rsnapshot;
  • Whether the remote .ssh and authorized_keys permissions are too wide;
  • whether cron actually runs as root instead of test;
  • Whether the host key has been confirmed by the same account.

SSH Works, but rsync Reports command not found

Confirm the remote path:

1
ssh [email protected] 'command -v rsync'

If rsync is installed in a nonstandard location, append the option to that backup point:

1
+rsync_long_args=--rsync-path=/usr/local/bin/rsync

Don’t guess the path, actually confirm it on the remote machine first.

The Remote Directory Is Not Readable

First test with the remote backup account:

1
2
sudo -u test -H ssh [email protected] \
  'ls -lah /data/files/'

Then bypass rsnapshot and test rsync directly:

1
2
3
sudo -u test -H rsync -avhn \
  [email protected]:/data/files/ \
  /tmp/remote-backup-test/

If Permission denied still occurs, the problem is the remote account’s directory traversal or file-read permissions, not rsnapshot. Check them on the remote system:

1
2
namei -l /data/files/
sudo -u backupuser find /data/files/ -maxdepth 2 -type f -readable | head

Prefer authorization via dedicated read-only accounts, group permissions, or ACLs. Don’t change the entire source directory to be readable and writable by everyone just to save trouble.

The SMB Mount Reports Permission denied

First check the kernel log and mount errors:

1
2
3
sudo mount -v -t cifs //192.168.8.100/files /mnt/source/windows-files \
  -o ro,credentials=/root/.smb-backup-credentials,vers=3.0
sudo dmesg | tail -50

Check the share name, username, domain, credential file permissions, and whether the NAS allows access for the account. Only try other vers= if the server is truly older, don’t consider downgrading to an older protocol as a default solution.

rsnapshot Succeeds, but the Windows or NAS Snapshot Is Empty

Check the source mount immediately:

1
2
3
findmnt -T /mnt/source/windows-files
mountpoint /mnt/source/windows-files
ls -lah /mnt/source/windows-files | head

If the share is not mounted, stop further rotations, restore the mount, and then run daily. Do not keep running against an empty mount point, or successive snapshots will record an empty source.

rsnapshot -t Looks Correct, but the Real Run Still Fails

-t primarily displays the command that will be executed and does not fully verify permissions, capacity, network stability, and all file names during transfer. Think of dry-run as a first check, not a guarantee of success.

Check the log:

1
2
sudo tail -200 /var/log/rsnapshot.log
sudo journalctl --since today | grep -E 'rsnapshot|rsync|cifs|nfs'

Copy the rsync command in the log and run it separately to confirm whether it is a network, permission, file name or disk issue.

Disk Usage Grows Unexpectedly

First distinguish between “many file changes” and “hard link failure”:

1
2
3
4
df -h /mnt/backup/rsnapshot
df -i /mnt/backup/rsnapshot
sudo du -xsh /mnt/backup/rsnapshot
sudo rsnapshot du

A large number of small files will exhaust inodes first; database files, virtual machine images, and large files that continue to change may occupy new complete file space in new snapshots even if only a small part is changed.

Space reuse will also fail if the snapshot root directory is moved to a file system that does not support hard links, or if different snapshots span file systems. Recheck:

1
2
3
findmnt -T /mnt/backup/rsnapshot
ls -li /mnt/backup/rsnapshot/daily.0/某文件
ls -li /mnt/backup/rsnapshot/daily.1/某文件

cron Does Not Run

Confirm crontab content:

1
2
3
sudo crontab -l
systemctl status cron --no-pager
sudo journalctl -u cron --since today

cron environment variables are fewer than interactive shells, so absolute command paths should be used in tasks. Do not rely on temporary settings of PATH in the shell, SSH agent, or manual mount status.

If the command works manually but not from cron, compare the execution account, HOME, SSH key, known_hosts file, and mount visibility in both environments.

Jobs Overlap or Run Indefinitely

Check the progress:

1
2
pgrep -af 'rsnapshot|rsync'
sudo lsof /run/lock/rsnapshot.lock

Do not directly delete the lock file without knowing the process stage. Check the log and process status first to confirm that there is no active rsnapshot, and then handle the remaining locks.

If the schedule window is frequently crossed, you should adjust the execution time, reduce the scan scope, fix the slow network, or use a unified flock lock instead of allowing multiple tasks to concurrently read and write the same snapshot root directory.

Why Do Deleted Source Files Still Exist in Older Snapshots?

This is expected. The new daily.0 can reflect a source-side deletion, while the older daily.1 and weekly.0 remain historical versions until their configured retention limits are exceeded.

Don’t manually go into old snapshots and delete files one by one to “sync state”. This defeats the purpose of historical retention and may accidentally delete data entries that are still shared via hard links.

How to Verify That a Backup Is Recoverable

Perform at least one sample restore each month:

  1. Select a snapshot from daily, weekly or monthly;
  2. Copy several different types of files to separate temporary directories;
  3. Check file sizes and checksums, and confirm that the files open correctly;
  4. Run consistency checks on bare Git repositories;
  5. Document recovery times and problems found.

Git bare warehouse can be randomly checked:

1
git --git-dir=/tmp/rsnapshot-restore/project.git fsck --full

Only the scheduled task success log is not enough. The true acceptance criterion is the ability to recover correct, usable data from a specified historical point.

A Practical Combined Configuration

The following example simultaneously backs up the local machine, remote Linux, Git bare repository, Windows share and NAS NFS. Please confirm that the columns in the code block are Tab:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
config_version	1.2

snapshot_root	/mnt/backup/rsnapshot/

cmd_cp	/usr/bin/cp
cmd_rm	/usr/bin/rm
cmd_rsync	/usr/bin/rsync
cmd_ssh	/usr/bin/ssh
cmd_du	/usr/bin/du

rsync_long_args	--delete --numeric-ids --relative

retain	daily	7
retain	weekly	4
retain	monthly	6

backup	/etc/	localhost/
backup	/home/	localhost/
backup	[email protected]:/data/files/	server50-files/
backup	[email protected]:/volume1/homes/git/./	git/	+rsync_long_args=--rsync-path=/usr/bin/rsync --include=/*.git/*** --exclude=*
backup	/mnt/source/windows-files/	windows-files/
backup	/mnt/source/nas-files/	nas-files/

The online order should be fixed as:

1
2
3
4
sudo rsnapshot configtest
sudo rsnapshot -t daily
sudo rsnapshot daily
sudo find /mnt/backup/rsnapshot/daily.0 -maxdepth 3 -type d | head -100

Confirm item by item:

  • The snapshot root directory is located on the correct backup disk;
  • SMB and NFS share real mounts and are readable;
  • SSH connections require no interaction;
  • dry-run has no unexpected sources or targets;
  • .git filter results include only expected directories;
  • All key files can be found in daily.0;
  • Use hard links for unchanged files in the second snapshot;
  • The recovery test was able to successfully open the file.

Finally enable cron. This way when a problem occurs, you can clearly distinguish between configuration syntax, SSH, share mounts, source permissions, disk capacity, and timing environment, without attributing all errors to rsnapshot.

References