Skip to main content
In this lesson, we cover two fundamental Linux backup tools:
  1. rsync for efficient file-level synchronization
  2. dd for creating bit-for-bit disk or partition images
While there are many advanced backup utilities, mastering these native commands ensures you can handle common backup and restore tasks on any Linux system.

Synchronizing Files with rsync

rsync (remote synchronization) efficiently copies and updates files between two locations, either locally or over SSH. It transfers only changes, saving bandwidth and time.

Basic Syntax

rsync [options] [source/] [user@remote_host:/path/to/destination/]
OptionDescription
-aArchive mode: preserves permissions, timestamps, symlinks, recursion
-vVerbose output
-hHuman-readable numbers
-PShow progress and keep partially transferred files
Always include a trailing slash on the source directory (source/) to copy its contents rather than the directory itself.

Examples

Sync local → remote:
rsync -avhP Pictures/ [email protected]:/home/aaron/Pictures/
Sync remote → local:
rsync -avhP [email protected]:/home/aaron/Pictures/ Pictures/
Sync two local directories:
rsync -avh /path/to/source/ /path/to/destination/

Creating Disk Images with dd

The dd command performs a low-level copy of a disk or partition, producing an exact image file. This is ideal for full-system backups or forensic duplication.
Before imaging, unmount the target partition or disk to prevent data corruption:
sudo umount /dev/vda1

Basic dd Command

sudo dd if=/dev/vda of=diskimage.raw bs=1M status=progress
OptionPurpose
if=Input file (source disk/partition, e.g., /dev/vda)
of=Output file (destination image, e.g., diskimage.raw)
bs=Block size (e.g., 1M for faster transfer)
status=progressDisplay ongoing copy progress

Sample Output

$ sudo dd if=/dev/vda of=diskimage.raw bs=1M status=progress
1340080128 bytes (1.3 GB) copied,  3 s, 432 MB/s

Restoring a Disk Image

To write the image back to a disk (this will overwrite the target):
sudo dd if=diskimage.raw of=/dev/vda bs=1M status=progress
Ensure you specify the correct of= target. Writing to the wrong device can destroy your data.

Next Steps

Continue your journey in Linux file management:
  • Explore advanced tar options for incremental backups
  • Automate backups with cron or systemd timers
  • Integrate encryption with gpg or LUKS for secure archives