Command line
irsync [OPTIONS] SRC... DEST
irsync [OPTIONS] HOST:[PATH]
irsync COMMAND ...
irsync --help prints the same flags with one line each; irsync COMMAND --help does so for a subcommand.
Operands
Each operand is a local path or HOST:PATH. HOST is a host alias from the
configuration or an EndpointId; PATH is resolved
on the daemon’s machine, as described in
Remote addresses.
A HOST that is neither is taken as an ssh destination, such as myserver or
me@myserver. irsync then sets that machine up over ssh before it syncs: it
copies itself there when the server has no matching build, grants this client
access to any path ([immediate]), starts the daemon and saves HOST as an
alias with ssh = "HOST". It prints what it did. Later runs dial the alias
over iroh and do not use ssh. A sync to an alias with ssh dials once and
waits at most 15 seconds (--dial-retries sets how often it retries first).
When the daemon does not answer, irsync checks the server over ssh once,
starts the daemon again or updates the alias, and retries with the usual
--dial-retries and --reconnect settings. That check never adds back an
immediate grant removed on the server. When ssh itself fails, irsync says
so and tries the daemon once more with the usual settings; if that fails too,
it reports both errors. A daemon that answers and refuses the client is never
handled over ssh. See
the quick way.
- A
:before the first/makes an operand remote, as in rsync. To name a local file whose name has a colon, write./name:with:colons. - Exactly one side is remote. A push (local to remote) may have several sources; each one runs as its own session, one after the other. A pull has one source.
- rsync’s trailing-slash rule holds on both sides:
Photos/copies the directory’s contents,Photoscopies the directory itself. - A single remote operand lists instead of copying.
irsync HOST:prints the exports this client may reach, oneNAME PATH ACCESSline each, whereACCESSisrworrowith the export’sread_onlyapplied.irsync HOST:PATHprints the files a pull would fetch and writes nothing; it recurses unless--no-recursiveis given. A listing does not redial: if the connection fails, it exits instead of waiting out the reconnect window.
The daemon honours the client’s flags in both directions, filters included.
rsync-compatible flags
These have rsync’s spelling and meaning. The flags that have rsync’s spelling and a different meaning follow in the next table.
| Flag | Meaning |
|---|---|
-a, --archive | Archive mode, the same as -rlptgoD. |
-r, --recursive | Recurse into directories (implied by -a). Without recursion only the top-level entries are transferred, and directories are skipped. |
--no-recursive | Turn off the recursion that -a implies. Also spelled --no-r. |
-d, --dirs | Without recursion, transfer directories without their contents. |
-l, --links | Copy symlinks as symlinks. Without it they are skipped. |
-p, --perms | Preserve permissions. |
-t, --times | Preserve modification times. |
-g, --group | Preserve the group, where the receiving user may set it. |
-o, --owner | Preserve the owner, only when the receiving side runs as root. |
-D | The same as --devices --specials. |
--devices | Preserve character and block device nodes. |
--specials | Preserve FIFOs. Sockets are never copied. |
-H, --hard-links | Files linked together in the source are linked together in the destination. |
-v, --verbose | List each file transferred, and end with rsync’s sent … received … and total size is … lines. -vv adds a summary of time, CPU, memory and bytes at the end of each session, and info logs; -vvv debug logs, -vvvv trace logs. |
-q, --quiet | Print errors only. Also turns the live progress block off. |
-n, --dry-run | Change nothing on either side. With -v or -i, list what would be done. |
-c, --checksum | Compare by content, not by size and time: every file on both sides is read, no cached hash is trusted, and the index is refreshed from what was read. |
-u, --update | Skip files that are newer on the destination. |
--delete-before | Delete before the transfer, once both sides are listed. |
--delete-during | Delete each directory’s extraneous entries as the run leaves that directory, so space is freed as the run goes. |
--delete-after | Delete after the transfer; what --delete does. |
--max-delete N | Stop deleting after N removals. The run exits with code 25. |
--exclude PATTERN | Exclude paths that match an rsync pattern: *, **, ?, [...]; a leading / anchors the pattern to the root, a trailing / matches directories only. |
--include PATTERN | Include paths that match, even if a later --exclude would hide them. |
--exclude-from FILE | Read exclude patterns from FILE, one per line. Blank lines and lines that start with # or ; are skipped. |
--include-from FILE | Read include patterns from FILE, as --exclude-from does. |
--bwlimit RATE | Limit the rate. A bare number is KiB/s. K, M, G, T, P (also KiB to PiB) are powers of 1024, KB to PB powers of 1000, b is bytes; decimals are allowed (1.5M). 0 means no limit. |
--numeric-ids | Apply owner and group ids as sent. By default the sender’s user and group names are mapped to the receiver’s ids where they exist, as rsync does. |
--partial-dir DIR | Keep the partial files of interrupted transfers under DIR, relative to the destination root, instead of beside their files. On a pull DIR may be absolute; on a push the daemon keeps them, and only a relative DIR inside the destination is allowed. |
--inplace | Write a changed file into the destination itself instead of into a temporary file renamed over it. No second copy is needed on disk, but readers see a torn file during the transfer and a crash leaves a mixture. |
--append | Extend a destination file that is shorter than the source with the source’s tail, trusting what is already there. A destination that is not shorter is skipped. |
--append-verify | Like --append, but the existing prefix is verified too. |
--fsync | Flush each received file to disk before renaming it into place, on whichever side receives (the daemon, on a push). Off by default, as in rsync: a power loss or kernel crash in the seconds after a run can then leave a file at its name with the right size and time but not its content, which the next run’s quick check does not notice (-c does). An export’s fsync = true turns it on for every push into it. |
--paranoid | Guard against source files that change during the sync, including writers that leave the times alone (memory-mapped databases; tested on ZFS 2.4 clones only, see the page linked below). The sending side (on a pull, the daemon) sends each file from a reflink clone where the filesystem can make one (btrfs, xfs, ZFS 2.2 and newer with block cloning, bcachefs, APFS), and otherwise hashes the file a second time before the receiver places it. At the end it checks every listed file again and sends those that changed. Files that vanished give exit 24. Cost: one clone and one delete per sent file where cloning works; an extra full read per sent file elsewhere; one stat per listed file at the end. Clones live in .irsync-clones-<uid> in a writable directory on the file’s filesystem. See Files that change during a sync. |
--ignore-errors | Run the deletion pass even when a listing was cut short by I/O errors. |
--stats | Print a block of transfer statistics at the end. |
-i, --itemize-changes | Print rsync’s per-file change summary, the itemize codes. |
-h, --help | Print the flags. |
-V, --version | Print the version and the commit it was built from. |
Filter rules apply in command-line order, and the first rule that matches wins.
rsync spelling, different meaning
| Flag | irsync | rsync |
|---|---|---|
--delete | Delete destination files that are gone from the source, after the transfer, the same as --delete-after. Nothing is deleted without one of the --delete flags. | The same as --delete-during. |
--delete-excluded | Also delete destination files that the filters exclude. Implies --delete, so the deletions run after the transfer. | Implies --delete, so the deletions run during the transfer. |
-S, --sparse | Leave chunks that are all zeros as holes. Without it, only files that are sparse in the source are written sparse. | Finds runs of zeros at write granularity, not only whole chunks. |
--timeout SECS | Drop a connection that moves no data and no control message for SECS seconds; the session then reconnects. 0, the default, means no timeout. | A connection idle for SECS seconds ends the run with code 30. |
--progress | Draws the live progress block (see Output) when stdout is a terminal. | Prints the progress of each file. |
-P | The same as --progress. irsync always keeps partial files. | The same as --partial --progress. |
--info SPEC | Only progress1 and progress2 are read, as --progress; the rest is ignored. | Selects informational output, such as the progress of the whole transfer with --info=progress2. |
Deletions
Nothing is deleted that might merely have been unreadable. When a listing on
either side is incomplete, because a directory could not be read or an entry
could not be examined, deletions stop from that point on: --delete-before
and --delete-after then delete nothing, and --delete-during stops at the
directory where the gap was found. --ignore-errors deletes anyway. Combine
--delete with -n first to see what it would remove.
Output
As in rsync, a sync prints nothing on stdout by default. Errors and warnings
go to stderr, each failed file as it fails. -v lists each file transferred
and ends with the sent … received … and total size is … lines; -q
prints errors only.
With --progress (or -P) on a terminal, the client draws a live block at the bottom of the screen: the
listing walk on both sides, a transfer bar with rsync’s percent semantics, one
row per file that is being hashed or has a data stream open and is not yet
sent in full, and the deletion pass. The rows are as many as half the
terminal’s height allows, largest file first; a last line … and N more
counts the others. The transfer bar’s N in flight counts these files,
including those beyond the rows drawn. It is not the session’s window of up to
4,096 files in flight described in
Files in flight and streams:
a file in that window that is neither being hashed nor has a stream open has
no row and is not counted. While the block is drawn, failed files show in its
errors section instead of scrolling, and the full list goes to stderr once the
block is cleared at the end. -q turns the block off. When stdout is not a
terminal, or TERM is dumb, the block is not drawn and the output is plain
lines.
irsync flags
These have no rsync counterpart.
| Flag | Meaning |
|---|---|
--parallel N | Data streams a push keeps open at once, across all files. Default: parallel from the host entry, else from [client], else 128. A pull uses the daemon’s 128. See Files in flight and streams. |
--reconnect DUR | How long to keep redialling after a dropped connection, as <N>[s|m|h|d]. 0 gives up at once, like rsync. Default: reconnect from the host entry, else from [client], else 24h. This window applies only once the server has answered; before that, --dial-retries applies. |
--dial-retries N | How often to retry a server that has not answered yet, before the run gives up. The waits grow: about 1, 2, 4, 8 seconds and so on, capped at a minute. 0 gives up on the first failure. Default: dial_retries from the host entry, else from [client], else 4. |
--relay URL | Use this relay server instead of the host entry’s, [client]’s or n0’s default. Cannot be combined with --no-relay or --address. |
--no-relay | Direct connections only: never fall back to a relay. The address lookups stay on. Default: relay_mode from the host entry, else from [client]. |
--no-dht | Do not look the daemon up in the mainline DHT. |
--address ADDR | Dial the daemon at ip:port, [ipv6]:port or host:port directly; repeatable. Turns the relay, DNS, DHT, mDNS and the port mapper off. The daemon’s EndpointId is still required and still checked. |
--config PATH | The config file. Default: ~/.config/irsync/irsync.toml. A hosts.toml or exports.toml beside it is read too. |
--rsh CMD | The remote shell for the ssh setup, split on spaces like rsync’s -e, for example --rsh "ssh -p 2222". Default: IRSYNC_RSH, else ssh. |
--ssh | Go through ssh even for a saved host: install or update irsync on the server, check its daemon and the grant, then sync. Uses the host’s ssh destination, else the alias. Default: off; a saved host is reached over iroh only. |
--no-remote-dht | When setting the server up over ssh, turn its DHT publishing off ([daemon.discovery] dht = false); a running daemon re-reads its settings. Goes through ssh for a saved host too, like --ssh. Without it the server’s setting is left alone, and new servers publish. |
--identity FILE | The private key to connect with. Default: identity in the config file, else ~/.config/irsync/id_ed25519 when it exists, else ~/.ssh/id_ed25519 when it exists, else a key generated at ~/.config/irsync/id_ed25519. A named file is the whole answer: when it is missing, a key is generated there. |
--passphrase-file PATH | Read the passphrase of an encrypted key from the first line of this file. Without it, IRSYNC_PASSPHRASE is used, else a prompt when stdin is a terminal. |
--no-resume | Start a fresh plan instead of resuming a dormant session. Partial files are still picked up. |
--no-rename-detection | Do not fill files from other files on the receiving side that hold the same content or parts of it, so a moved or copied file is transferred again. A changed file still reuses its own old version. |
--debug-addr ADDR | Serve metrics and span timings over HTTP at IP:PORT; a bare port means 127.0.0.1. The port stays open after the sync until SIGINT or SIGHUP. |
--debug-port-no-wait | With --debug-addr, close the port when the sync ends instead of waiting. |
The connection settings resolve in this order: the flag, then the host
alias’s table, then [client], then the built-in default. See
Configuration.
Subcommands
| Command | What it does |
|---|---|
irsync daemon | Run the daemon. See below. |
irsync index | Hash the files under local roots into their index. See Seed the index. |
irsync gc | Remove abandoned partial files, dormant sessions and stale index entries. See Clean up state. |
irsync host, export, grant, id, config, show | Manage aliases, exports, grants, identities and settings. See Management commands. irsync grant add immediate WHO lets WHO reach any path, read-write; it is what the ssh setup grants. |
irsync daemon
irsync daemon [--config PATH] [--passphrase-file PATH] [--listen ADDR]... [-v|-q]
Serves the exports in the config file to the peers they are granted to, until
it is interrupted. At start it prints endpoint id: <EndpointId> and one
listening on: <socket> line per bound socket on stdout. Logs go to stderr at
info level; -v gives debug, -vv trace, -q errors only, and RUST_LOG
overrides all of them.
| Flag | Meaning |
|---|---|
--config PATH | The config file. A hosts.toml or exports.toml beside it is read too. |
--passphrase-file PATH | Read the passphrase of an encrypted daemon key from the first line of this file. |
--listen ADDR | Bind this socket (ip:port, [ipv6]:port or host:port; port 0 lets the system pick) instead of the config’s listen list. Repeatable, at most one IPv4 and one IPv6. |
-v, --verbose | Log more; repeat for more still. |
-q, --quiet | Log errors only. |
irsync index
irsync index [-n] [-v|-q] [--config PATH] ROOT...
| Flag | Meaning |
|---|---|
-n, --dry-run | Walk and count what would be hashed; read nothing. |
-v, --verbose | Log more. |
-q, --quiet | Log errors only and print no summary. |
--config PATH | The config file, for state_dir. |
irsync gc
irsync gc [-n] [-v|-q] [--config PATH]
| Flag | Meaning |
|---|---|
-n, --dry-run | List what would be removed without removing anything. |
-v, --verbose | Log more. |
-q, --quiet | Log errors only and print no summary. |
--config PATH | The config file, for state_dir. |
Environment
| Variable | Effect |
|---|---|
IRSYNC_PASSPHRASE | The passphrase of an encrypted key, when no --passphrase-file is given. |
IRSYNC_RSH | The remote shell for the ssh setup, when no --rsh is given. |
RUST_LOG | The log filter, in place of the one -v and -q choose. |
OTEL_EXPORTER_OTLP_ENDPOINT | Export traces and metrics over OpenTelemetry to this endpoint. Overrides [telemetry] in the config file. |
TERM | dumb turns the live progress block off. |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success. |
| 1 | Nothing got through: a configuration, identity or connection error; an operand pair irsync rejects (both sides local, both remote, several sources on a pull); or every source failed. |
| 2 | The command line could not be parsed: an unknown flag, a bad value, a missing operand. |
| 23 | Partial transfer: some files could not be transferred, or some sources of a push failed while others synced. |
| 24 | Some source files vanished. Only --paranoid, in its final re-check, gives this. |
| 25 | Deletions stopped at --max-delete. |
Of these, 23, 24 and 25 have rsync’s meaning; 1 and 2 do not (rsync uses 1 for a syntax or usage error and 2 for a protocol incompatibility).
When several apply, 1 wins over 25, 25 over 23, and 23 over 24. A file listing, irsync HOST:PATH, is a dry-run pull and
uses the same codes; the export listing, irsync HOST:, exits 0 or 1.
The other commands exit 0 on success and 1 on an error, with these
additions: irsync index and irsync export update exit 23 when a file could
not be read or a directory could not be listed, and irsync config get exits
1 for a key that is not set and has no default.