Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Files and state

What irsync reads and writes outside the trees it syncs, and what it leaves inside them.

Config directory

All under ~/.config/irsync/, all optional. There is no lookup under /etc; a daemon run system-wide is given --config (see Run the daemon).

FileHolds
irsync.tomlThe whole configuration: identity, state_dir, [client], [daemon], [telemetry], the [hosts.*] aliases, the [exports.*] tables and the [all] grants. --config PATH names another file; the files below are then looked up beside it. See Configuration.
hosts.toml, exports.tomlOptional split files, read as part of irsync.toml. irsync never edits them. See Configuration.
irsync.toml.lockPresent only while a management command edits the file. See Management commands.
id_ed25519, id_ed25519.pubThe client’s key, generated when no other key serves. See Configuration.
daemon_ed25519, daemon_ed25519.pubThe daemon’s key, [daemon] identity, generated when missing by the daemon, irsync export add or irsync show, or on demand by irsync id generate --daemon.

Generated private keys are written with mode 0600, in OpenSSH format. The .pub file beside each holds the public key line. irsync id show prints the EndpointId of either key, under a client: or daemon: label; see Management commands.

State directory

state_dir defaults to ~/.local/state/irsync, or $XDG_STATE_HOME/irsync when that is set. The client and the daemon use the same layout.

PathHolds
index/<hash>.sqliteOne SQLite database per root: a local directory the client synced or indexed, or an export. <hash> is 32 hex digits of the BLAKE3 hash of the root’s canonical path; the database records the path too.
index/<hash>.sqlite-wal, -shmSQLite’s write-ahead log and shared memory, beside each database.
daemon.lockHeld by the running daemon, so a second daemon with the same state directory refuses to start. It holds the daemon’s pid, the path of its program (exe) and its version, one key=value line each. The ssh setup reads it to tell whether a daemon runs and which build it is.
daemon.addrWhere the running daemon can be reached right now: its pid, its home relay and each direct addr, one key=value line each, rewritten whenever they change. The ssh setup passes them to the client, so the first sync to a daemon it just started does not wait for the daemon to appear in the DHT or DNS.
daemon.logThe log of a daemon the ssh setup started. A daemon you start yourself logs to stderr instead.

Each database holds:

  • the file hashes of the root, which let a session skip unchanged files and reuse chunks of renamed and copied ones;
  • the progress of partial files, so that an interrupted transfer resumes where it stopped;
  • dormant sessions, so that the next run of the same sync resumes its plan;
  • the time of the last garbage collection.

Exports with the same path share one database.

The whole directory is safe to delete. The next sync rebuilds what it needs, at the cost of hashing files again and of losing the sessions that could have resumed. Clean up state removes only what nobody is coming back for.

On a server set up over ssh

The ssh setup puts its own copy of irsync on the server at ~/.local/share/irsync/bin/irsync. It replaces that copy when the client runs a different build, and leaves an irsync you installed elsewhere alone. Over ssh it then runs irsync ssh-setup, a hidden command that grants the client, makes the daemon’s key when it is missing and starts the daemon. The server’s config, keys and state are the usual ones above; the daemon it starts writes daemon.log in the state directory.

In the synced trees

A receiver writes into temporary files beside their destinations and renames them into place:

NameWhat it is
.irsync.<name>.partA file being received. An interrupted transfer leaves it behind for the next run to resume. With --partial-dir DIR these files live under DIR instead.
.irsync.<name>.tmpA symlink, hard link or special file being made, renamed into place at once.

When the full name would exceed 255 bytes, <name> is cut and ~ plus 16 hex digits of a BLAKE3 hash of the whole name is put before the suffix, so two long names with the same beginning still get different temporary files.

Names that start with .irsync. and end in .part or .tmp are never listed, never accepted from a peer and never created as destinations.

With --paranoid, the sending side keeps reflink clones in a folder named .irsync-clones-<uid> (the uid in decimal) in a writable directory on each file’s filesystem. A directory named exactly .irsync-clones- followed by digits is never listed and so never synced or deleted; a name such as .irsync-clones-backup is an ordinary directory.

Garbage collection removes .part files and their progress records once they have gone untouched for longer than dormant_session_timeout (7 days by default; the client always uses 7 days), unless a stored session still lists the file. It removes only regular files with that exact form of name, and never follows a symlink. Progress records do not remember a --partial-dir: a stale record whose .part file is not beside its destination is dropped, and the file itself, if it exists, is collected on a later pass by its age. When and how often collection runs is in Clean up state.