Preview an rsync Backup Before Copying Files: Dry Run and Trailing Slash

Add --dry-run --itemize-changes to your planned rsync command before a local backup. For rsync, source/ means copy the contents of the source folder to the destination, while source usually creates another folder level under an existing destination. Confirm the paths first and omit any deletion option when you want a simple additive copy.

Run the preview with the exact paths

Choose a real, already mounted backup drive and make a dedicated destination folder. If a removable drive is missing, a familiar-looking mount path could refer to your system drive. Confirm there is enough destination space and independently check the drive’s name or mount location.

For example, from a shell with a scratch data folder and a separate backup folder, a preview can look like this:

rsync -a --dry-run --itemize-changes -- "$HOME/reports/" "/path/to/backup/reports/"

Replace the illustrative destination with your verified path. The quotes protect spaces. The output is a proposal, not evidence of a finished copy. Confirm that it shows the intended set of names and no surprising nested reports/reports path when you inspect the destination after the first real run.

Interpret a source slash with a small example

Suppose reports/ contains only summary.txt and an empty backup/ already exists. rsync -a reports/ backup/ puts the file under backup/summary.txt. rsync -a reports backup/ puts it under backup/reports/summary.txt. This is a hypothetical path illustration. The behavior matters when a later restore script expects files at one exact level.

Archive mode includes more than file contents, such as permissions or symlinks where supported. When the destination uses a different filesystem or access model, rsync may report attribute errors even if a file appears. Read the warnings and check whether the metadata matters to your restore.

Copy, then test something you can restore

After reviewing the preview, run the same command without --dry-run and read the exit status. Spot-check a few documents and use a checksum comparison for at least one important file if you need content confirmation. A second preview should usually show no pending ordinary file changes after a successful run if the source is unchanged and the destination preserves the attributes rsync compares.

Keep versioned or separate backups for files you might overwrite. An additive rsync can still update a destination file of the same name. Do not add --delete unless removal of destination-only files is a deliberate mirror policy.

Sources

댓글

이 블로그의 인기 게시물

소니 A6000 Wi-Fi 전송 (컴퓨터로 보내기)

SVN 서버 설치 및 웹 접속 설정-Ubuntu 14.04

VirtualBox(VM) 화면 크기 조절