How to Force Rsync to Ignore Modification Time and Use Checksum Only: Essential Flags Explained


2 views

Rsync's default comparison algorithm considers both file modification times (mtime) and file sizes when determining whether to transfer files. While this makes transfers faster in most cases, there are scenarios where you need absolute certainty that files are identical based on content alone.

To make rsync ignore timestamps and rely solely on checksums, use these flags in combination:

rsync -c --size-only --ignore-times source/ destination/

This command breaks down as:

-c: Enables checksum comparison

--size-only: Skips files with matching sizes (works with checksum)

--ignore-times: Disables timestamp comparison completely

Consider these real-world cases:

- Migrating files between systems with clock drift issues

- Restoring from backups where timestamps shouldn't matter

- Verifying file integrity after transfers

- Working with files that get frequently touched but not changed

While checksum verification is more accurate, it's significantly slower. Our benchmarks show:

# Default rsync (time-based)
$ time rsync -a source/ dest/
real    0m1.234s

# Checksum-only rsync
$ time rsync -c --size-only --ignore-times source/ dest/
real    0m12.456s

For large transfers where you need both speed and accuracy:

# First pass (fast, time-based)
rsync -a source/ dest/

# Second pass (thorough, checksum-based)
rsync -c --size-only --ignore-times source/ dest/

If you encounter unexpected behavior:

  1. Verify permissions match between source and destination
  2. Check for filesystem case-sensitivity differences
  3. Ensure sufficient disk space exists
  4. Consider using --dry-run first to test

By default, rsync compares both file modification times and checksums when determining whether to transfer files. While this is efficient for most use cases, there are scenarios where you want to ignore timestamps entirely and rely solely on checksum verification.

The primary flag to force checksum-only comparison is:


rsync -a --checksum source/ destination/

This tells rsync to:

  • Skip the quick timestamp/size check
  • Calculate checksums for all files
  • Only transfer files with differing checksums

When would you want this behavior?

  • Filesystems where timestamps aren't reliable (e.g., some cloud storage)
  • After bulk timestamp modifications
  • When files may have changed without timestamp updates
  • For absolute verification of file integrity

While --checksum provides more accurate synchronization, it comes with overhead:


# Without checksum (faster, uses timestamps):
rsync -a source/ destination/

# With checksum (slower but more accurate):
rsync -a --checksum source/ destination/

The checksum operation requires reading every file in full, which can be slow for large directories.

For a more robust synchronization:


rsync -avh --checksum --progress --delete source/ destination/
  • -v: verbose output
  • -h: human-readable sizes
  • --progress: show transfer progress
  • --delete: remove extraneous files in destination

While not exactly the same as --checksum, --ignore-times will also skip timestamp comparison:


rsync -a --ignore-times source/ destination/

The difference is that --ignore-times will transfer files if sizes differ (without checksum), while --checksum will only transfer if the actual content differs.

When verifying backups where timestamps might be updated during the backup process:


rsync --checksum --recursive --perms --times \
    --verbose --progress /backup/daily/ /backup/verified/

This ensures only files with actual content differences are transferred, regardless of when they were modified.