Custom rsnapshot backup sequence

Abstract: Configure rsnapshot retention policies, snapshot roots, and sources to create a robust versioning strategy that minimizes storage consumption while preventing data loss.

Created: 2026-09-26 by

Creating a custom rsnapshot backup sequence involves configuring the rsnapshot.conf file to define specific retention intervals, such as daily, weekly, and monthly snapshots. By adjusting the retain directives and understanding how rsnapshot utilizes hard links for space efficiency, you can build a robust versioning strategy that prevents data loss while minimizing storage consumption.

Understanding Rsnapshot Retention Policies

The core of any rsnapshot configuration is the definition of your retention schedule. Unlike traditional backup tools that overwrite previous versions, rsnapshot creates incremental backups by using hard links. This means that if a file has not changed since the last backup, it is not copied again; instead, a new hard link is created in the snapshot directory pointing to the same inode on the disk. This mechanism allows you to maintain multiple full-looking backups with minimal additional disk usage. To establish a custom sequence, you must edit the main configuration file, typically located at /etc/rsnapshot.conf. The structure relies on a series of retain lines followed by the corresponding command line arguments. For example, a common setup might look like this:
# Keep 7 daily snapshots
retain  daily   7

# Keep 4 weekly snapshots
retain  weekly  4

# Keep 3 monthly snapshots
retain  monthly 3
This configuration tells rsnapshot to keep seven copies of the most recent daily backups, four weekly backups, and three monthly backups. When you run rsnapshot, it will execute these tasks in order. If you exceed the number of retained snapshots, rsnapshot automatically removes the oldest one to make room for the new one. Understanding this hierarchy is crucial because it dictates which data persists over time. A daily backup might be deleted after seven days, but if that day also corresponds to a weekly retention point, the data remains until the weekly slot is cleared. For more details on managing these data backups effectively, you can refer to our guide on [How to Manage Data Backup with Rsnapshot](/news/1480036/rsnapshot-data-backup).

Configuring Snapshot Root and Sources

Once your retention policy is set, you need to define where the backups are stored and what data is being backed up. The snapshot_root directive specifies the base directory for all snapshots. It is critical that this path exists and is writable by the user running rsnapshot (usually root or a dedicated backup user).
snapshot_root   /backup/rsnapshot/
Following this, you define the source directories and their destinations. The syntax is straightforward: backup followed by the source path, then the destination path relative to the snapshot root. You can also exclude files using the exclude_file directive or inline exclusions.
backup    /home/    home/    exclude=/home/user/.cache/*
backup    /etc/     etc/
backup    ssh://user@remotehost//var/log/    remote_logs/
In the example above, we are backing up local /home and /etc directories, as well as logs from a remote server via SSH. Note that when backing up remote hosts, you must ensure that SSH keys are properly configured for passwordless authentication, or that an SSH agent is available. Also, remember that rsnapshot does not support incremental transfers over SSH in the same way rsync does natively without specific flags; it relies on the underlying rsync binary to handle the transfer logic efficiently.

Optimizing Performance and Safety

To ensure your custom backup sequence runs smoothly, you should tune several parameters in the configuration file. One of the most important settings is cmd_rsync, which points to the rsync binary. Ensure this path is correct for your system. Additionally, you can pass arguments to rsync via the rsync_long_args directive.
rsync_long_args   --delete --sparse --compress --numeric-ids
The --delete flag ensures that files deleted on the source are also removed from the latest snapshot, keeping your backups clean. However, use caution with this flag, as it can lead to data loss if misconfigured. The --sparse option helps save space by detecting sparse files, while --compress reduces bandwidth usage during network transfers. Another critical aspect is testing your configuration before relying on it for production data. You can perform a dry run to see what changes would be made without actually executing them.
rsnapshot -t daily
This command simulates the daily backup process. Review the output carefully to ensure that no unexpected deletions or errors occur. If the dry run looks good, you can proceed with the actual execution.

Scheduling Backups with Cron

Finally, automate your custom sequence using cron jobs. You do not need to write complex scripts; simply adding entries to the crontab is sufficient. Here is an example of how to schedule daily, weekly, and monthly backups:
# Daily backup at 1 AM
0 1 * * * /usr/bin/rsnapshot daily

# Weekly backup on Sunday at 2 AM
0 2 * * 0 /usr/bin/rsnapshot weekly

# Monthly backup on the 1st at 3 AM
0 3 1 * * /usr/bin/rsnapshot monthly
Ensure that the cron daemon is running and that the cron user has permission to execute rsnapshot. Logging is essential for troubleshooting. You can redirect the output of rsnapshot to a log file to monitor the progress and identify any issues.
0 1 * * * /usr/bin/rsnapshot daily >> /var/log/rsnapshot.log 2>&1
By combining a well-defined retention policy, proper source configuration, performance tuning, and reliable scheduling, you can create a custom rsnapshot backup sequence that is both efficient and secure. Always test your configurations thoroughly and monitor your logs to ensure your data remains safe.

Frequently Asked Questions

Does rsnapshot delete old backups automatically?

Yes, rsnapshot automatically removes the oldest snapshot when it exceeds the limit defined in the retain directives. This ensures that your disk space usage remains within predictable bounds based on your retention policy.

Can I back up to a remote server using rsnapshot?

Yes, you can back up to a remote server by specifying an SSH URL in the backup directive. However, you must ensure that SSH key authentication is set up correctly so that rsync can connect without manual intervention.

What happens if a backup fails midway?

If a backup fails, rsnapshot may leave behind partial directories. You should check the logs and manually remove incomplete snapshot directories if necessary. Regularly testing with the dry-run flag helps prevent such scenarios.

How does rsnapshot handle file permissions?

Rsbackup preserves file permissions, ownership, and timestamps by default. This is achieved through the underlying rsync utility, which ensures that the restored files behave exactly like the originals.

Is it safe to run rsnapshot concurrently?

No, you should not run multiple rsnapshot processes simultaneously for the same snapshot root. This can lead to conflicts and corrupted snapshots. Use locks or staggered timing to avoid concurrent executions.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More