borg known-repos

borg [common options] known-repos [options]

options

--json

format output as JSON

Common options

Description

Lists the repositories this local Borg installation currently has state for - security info (key type, last known location), a local repository cache, and/or key files - without accessing any repository itself (-r/--repo has no effect). “Layout” is which state was found in (not the on-disk repository format, see “borg repo-info” for that) - a security-only repo gets “unknown” when $BORG_SECURITY_DIR makes the borg2 and legacy security roots coincide.

“Last written” is a best-effort last-used proxy, not an exact timestamp and not a staleness check on its own. It is the newest mtime found among the repository’s security info file (which records the repository’s last known location) and, if a local cache exists, any regular file in that cache - whichever of the two is more recent. A mismatch between a legacy repo’s known location and its cache’s last location is flagged. A key file’s presence does not by itself mean the repository is still openable. Use --json for a machine-readable version.

Examples

$ borg known-repos
Repository ID                                                    Layout Cache Security           Key files Last written        Location
401606173d54eab22cd98de67278d093e3bae7b187da3af8c6430f18fa1112bb borg2  180 B aes256-ocb, sha256 -         2026-10-12T17:15:19 /path/to/repo

$ borg known-repos --json
{
    "repositories": [
        {
            "cache_size": 180,
            "has_cache": true,
            "has_security_info": true,
            "id": "401606173d54eab22cd98de67278d093e3bae7b187da3af8c6430f18fa1112bb",
            "key_file_count": 0,
            "key_type": "aes256-ocb, sha256",
            "last_written": "2026-10-12T17:15:19.785785+09:00",
            "layout": "borg2",
            "location": "/path/to/repo",
            "location_mismatch": false
        }
    ]
}