cmirrord - Linux


Overview

cmirrord is a command-line tool used for mirroring entire directories or specific files to one or multiple destinations, maintaining synchronization between them. It’s particularly useful for managing backups or replicating data between servers.

Syntax

cmirrord [-options] <source> <destination>

Options/Flags

| Option/Flag | Description | Default |
|—|—|—|
| -r | Recursively mirror directories | False |
| -l | Log mirroring activity to a file | N/A |
| -c | Check for file changes before mirroring | True |
| -n | Dry run; do not perform any file changes | False |
| -m | Max number of simultaneous file transfers | N/A |
| -i | Ignore file permissions | False |
| -f | Force copy of files even if they already exist | False |
| -u | Update mirrored files with newer versions from source | False |
| -d | Delete files from destination that do not exist in source | False |
| -s | Source path root; used for preserving directory structure | Source root |
| -h, --help | Print usage information | N/A |

Examples

Simple Mirroring:

cmirrord /var/www /backup/website

Mirroring with Recursive Option:

cmirrord -r /home/user/files /data/files

Dry Run with Logging:

cmirrord -n -l my_mirror_log.txt /old/path /new/path

Common Issues

  • Insufficient permissions: Ensure that the user running cmirrord has read and write permissions to both source and destination paths.
  • Duplicate files: If the -f flag is not used, cmirrord will skip copying files that already exist in the destination.
  • Source and destination paths not provided: Correctly specify both the source and destination paths as arguments.

Integration

  • Combine with rsync: Use cmirrord to monitor file changes and trigger an rsync backup when necessary.
  • Cron Scheduling: Schedule regular mirroring tasks using cron jobs.

Related Commands

  • rsync – A versatile tool for file synchronization and backup
  • robocopy (Windows) – A command-line utility for robust file mirroring
  • unison – A bidirectional file synchronization tool for distributed systems