Skip to end of metadata
Go to start of metadata


As with any copy/sync tool, make sure to test thoroughly with data that can be lost.

Test with the --dry and --dry-rsync options to verify that the operations match what you want to do.



rmirr provides a safe and easy to use way to set up and execute file storage mirroring instructions. And because it uses rsync to actually perform the synchronization, you get all the performance and availability benefits of rsync.


  • specify only the source file object (file, directory) to mirror
  • mirror settings selected by best match path
  • support one or more mirror destinations
  • ensure mirroring from specific sources only
  • ensure single instance of mirroring operation per mirror path
  • log history of mirroring invocations
  • save to file report of mirrored objects
  • email report file

Why not just use rsync directly?

Simple cases of mirroring files/directories can easily be done by using rsync directly. But, it does not provide any safeguards. For example, the following are not the same:

rsync -avz --delete /a/b/c mach2:/a/b/c


rsync -avz --delete /a/b/c/ mach2:/a/b/c

Assuming a directory is being synced, call #2 is correct, as it uses a trailing / on the source path. rmirr ensures that will be done properly.


usage: rmirr [<options>] [-n <name>] -p <path>
       rmirr [<options>] [-n <name>] -s <suitename>
       rmirr [<options>] -n <name>
       rmirr -l

Mirror file objects which can be specified by <path> (for which a
mirror is selected), <suite> (representing one or more paths), or
<name> (a mirror configuration).

-l      List mirror configurations.
-n <name>
        Mirror name.
-p <path>
        Mirror path.
-s <suitename>
        Alias for one or more paths.

-c <path>
        Location of paths.json configuration file.
-d <hostname>[,...]
        Destinations to mirror to from list in configuration.
        Enable debugging.
        Allow file object deletion.
--dry   Dry run. Do not execute.
        Dry run for rsync.
--mailto <emailaddr>[,...]
        Set/override recipients when mailing report.
        Mail report.
        Do not use/require lock to run.
        Disable safemode.
        Show report on console.
        Enable verbosity.
-y      Do not ask for confirmation before executing.


Configuration file is located at ~/.rmirr/rmirr.json.


List of email recipients when --mailreport is used.

smtp_serverSet SMTP server. Default is to use "localhost".
suites<suitename>List of paths to be mirrored.
mirrorscommentDescription of what is being mirrored.
destinationsList of destinations to which the source is to be mirrored each of the format [<user>@]]<host>:<path>.
email_recipientsList of email recipients when --mailreport is used. Overrides the value from the defaults section.
excludesList of file/dir names to exclude from the mirroring.
nameMirror configuration name.
sourceSource of the mirror: [<user>@]<host>:<path>.


Given the configuration at ~/.rmirr/rmirr.json:

	"defaults": {
		"email_recipients": []
	"suites": {
		"all": [
	"mirrors": [
			"name": "data-main--home--finance-hr",
			"comment": "data main: home -> finance, hr",
			"source": "",
			"excludes": [".snapshot", ".snapshots"],
			"destinations": ["", ""]
			"name": "data-finance--home--finance",
			"comment": "data finance: home -> finance",
			"email_recipients": [""],
			"source": "",
			"excludes": [".snapshot", ".snapshots"],
			"destinations": [""]
			"name": "data-hr--home--hr",
			"comment": "data hr: home -> hr",
			"source": "",
			"excludes": [".snapshot", ".snapshots"],
			"destinations": [""]

List suite and mirror settings:

rmirr -l

Mirror /data/main from

rmirr -p /data/main


  • mirrors to both and
  • .snapshot and .snapshots are excluded
  • by default, mirroring does not delete at the destination
  • by default, mirroring requires user interaction ("y" to proceed)

Show what rmirr would do without executing it (dry-run):

rmirr --dry -p /data/main

Mirror /data/main/opt:

rmirr -p /data/main/opt


  • because /data/main/opt is under /data/main, the settings for /data/main are used
  • only /data/main/opt is mirrored

Mirror /data/finance and allow deletion at the destination:

rmirr --delete -p /data/finance

Do a dry run (at rsync level) to mirror /data/finance with deletion and no user interaction:

rmirr --dry-rsync --delete -y -p /data/finance

Mirror /data/main to specific destination (

rmirr --delete -y -d -p /data/main

Request report be emailed:

rmirr -p /data/main --mailreport

Request report be output to console:

rmirr -p /data/main --showreport

Mirror the "all" suite:

rmirr -s all

Mirroring Selected File Objects

Sometimes only a subset of file objects (files, directories) need to be mirrored rather than a full tree. rmirr supports this with the names setting in the configuration file.

Configuration for mirroring bash files:

	"suites": {
		"bashfiles": [
	"mirrors": [
			"name": "my-bash-files",
			"comment": "my .bash files",
			"source": "",
			"excludes": [
			"destinations": [


  • the suites section defines a suite to reference those bash-specific file objects by a single name
  • of course, any changes/tweaks done at the destinations will be overwritten when rmirr is called

To mirror all the file objects of the "bashfiles" suite:

rmirr -s bashfiles

To mirror specific file objects:

rmirr -p /home/jdm/.bash_completion.d
  • No labels