How to Use rsync for Backup on Linux: A Step-by-Step Guide
HardReset.InfoJanuary 1, 20267 min28 views
3 connectionsΒ·5 entities in this videoβGetting Started with rsync
- π‘ rsync is a powerful tool for backups on Linux, and it's likely installed by default.
- π» To confirm, open your terminal and run
rsync --versionto check the installed version.
Setting Up Your Backup Environment
- π Create a directory for your data, for example, named
data, and populate it with sample files likefile1.txtandfile2.txt. - ποΈ Next, create a separate directory where your backups will be stored, named
backup.
Performing Basic and Incremental Backups
- π A basic local backup can be initiated with
rsync -av data/ backup/. The-aflag ensures archive mode (preserving permissions, owner, timestamps), and-vprovides verbose output. - π For incremental backups, rsync intelligently copies only changed files. If you modify a file in the
datadirectory (e.g., add a new line tofile1.txt) and rerun the command, rsync will only transfer the updatedfile1.txt.
Advanced Backup Strategies: Mirroring and Dry Runs
- πͺ A mirror backup synchronizes the source and destination, removing files from the backup directory if they are deleted from the source. Use the
--deleteflag:rsync -av --delete data/ backup/. - β οΈ To safely preview changes before they are applied, use the
--dry-runoption. This command (rsync -av --delete --dry-run data/ backup/) will show you what would be deleted or copied without actually performing the actions, allowing you to verify your backup strategy.
Knowledge graph5 entities Β· 3 connections
How they connect
An interactive map of every person, idea, and reference from this conversation. Hover to trace connections, click to explore.
Hover Β· drag to explore
5 entities
Chapters3 moments
Key Moments
Transcript28 segments
Full Transcript
Topics9 themes
Whatβs Discussed
rsyncLinuxBackupIncremental BackupMirror BackupDry RunArchive ModeTerminalCommand Line
Smart Objects5 Β· 3 links
ProductsΒ· 2
ConceptsΒ· 2
LocationΒ· 1