Skip to content

Metadata REST API

The metadata server exposes a REST API alongside its RPC protocol. The REST endpoints serve utilities and monitoring. All query parameters use kebab-case (e.g., volume-id, base-path). Each endpoint responds only to the HTTP method(s) shown below; a request to a valid path with an unsupported method receives 405 Method Not Allowed.

These parameters are accepted by most endpoints:

ParameterTypeDescription
vid / volume-idstringVolume UUID or name. Required by most endpoints; the volume-keyed and maintenance endpoints make it optional (omit = all open volumes).
base-pathstringBase32-encoded base path to scope the query
at-timeuint64Point-in-time in nanoseconds since epoch (for time-travel mounts)
prettyboolOn JSON endpoints, pretty=true indents the response (default is compact). No effect on text endpoints.
GET /analyze/files

Returns the top files by size, size_bin, or cost within a volume or subtree.

ParameterTypeDefaultDescription
vid / volume-idstringVolume UUID or name (required)
base-pathstringBase32-encoded path prefix
at-timeuint64Point-in-time (nanoseconds since epoch)
headerboolfalseInclude column headers
limituint32100Maximum results (1-1000)
order-bystringcostSort field: size, size_bin, or cost

Response: 200 OK with tab-separated text, one file per line.

GET /analyze/folders

Returns per-directory recursive size and cost.

ParameterTypeDefaultDescription
vid / volume-idstringVolume UUID or name (required)
base-pathstringBase32-encoded path prefix
at-timeuint64Point-in-time (nanoseconds since epoch)
headerboolfalseInclude column headers
max-depthuint320Maximum depth (0 = unlimited)

Response: 200 OK with tab-separated text.

GET /analyze/users

Returns per-user size and cost.

ParameterTypeDefaultDescription
vid / volume-idstringVolume UUID or name (required)
base-pathstringBase32-encoded path prefix
at-timeuint64Point-in-time (nanoseconds since epoch)
headerboolfalseInclude column headers
limituint32100Maximum results (1-1000)
order-bystringcostSort field: size or cost

Response: 200 OK with tab-separated text (UID, size, cost).

GET /find

Searches the filesystem with filters on inode attributes.

ParameterTypeDescription
vid / volume-idstringVolume UUID or name (required)
base-pathstringBase32-encoded path prefix
fieldsstringComma-separated output fields
headerboolInclude column headers
namestringDentry name filter (supports glob)
typestringInode type: b, c, d, f, l, p, s
uiduint32UID filter
giduint32GID filter
inouint64Inode number filter
limituint64Maximum number of results (0 or omit for unlimited)
emptyboolEmpty file/directory filter
sparseboolSparse file filter
permstringRequired permission bits (octal string, e.g. 0755). Matches when (mode & perm-mask) == perm.
perm-maskstringBits of the file mode to test (octal string, default 0777, max 07777)
min-size, max-sizeuint64Byte size range
min-blocks, max-blocksuint64Block count range
min-cost, max-costfloat64Monthly cost range
min-nlink, max-nlinkuint32Hard link count range
min-depth, max-depthuint32Depth range
min-atime, max-atimeuint64Access time range (seconds since epoch)
min-btime, max-btimeuint64Birth time range (seconds since epoch)
min-ctime, max-ctimeuint64Change time range (seconds since epoch)
min-mtime, max-mtimeuint64Modification time range (seconds since epoch)
min-size-bin, max-size-binuint32Size bin range (0-74)

Response: 200 OK with tab-separated text.

GET /find-old

Lists non-directory files whose access time is older than a cutoff — useful for identifying stale data. The Find endpoint is more capable and covers the same need via its max-atime filter.

ParameterTypeDefaultDescription
vid / volume-idstringVolume UUID or name (required)
coint642 years agoCutoff access time, in seconds since epoch. Files with atime older than this are returned.
limuint64100000Maximum number of results

Response: 200 OK with one line per file in the form size:atime:btime:base32path, where size is the effective size (min(size, blksize × blocks)) and atime/btime are seconds since epoch.

GET /duplicates

Returns groups of files that share the same size and block count, which are candidates for deduplication.

ParameterTypeDescription
vid / volume-idstringVolume UUID or name (required)
base-pathstringBase32-encoded path prefix
at-timeuint64Point-in-time (nanoseconds since epoch)
limituint64Maximum number of duplicate groups (0 or omit for unlimited). When set, the largest groups by file size are retained.
min-size, max-sizeuint64Byte size range
min-blocks, max-blocksuint64Block count range

Response: 200 OK with a JSON array of group objects, ordered by size descending then blocks descending. Each group has size (uint64), blocks (uint64), and files (array of {path, ino, nlink, btime} objects). Multiple paths for the same inode (hard links) are included as separate entries. When limit is set, only the largest groups are returned.

GET /locks

Lists the volume’s currently held file locks.

ParameterTypeDescription
vid / volume-idstringVolume UUID or name (required)

Response: 200 OK with a JSON array of active lock objects (empty array if the volume holds no locks).

GET /sessions

Returns the client sessions currently connected to the server.

ParameterTypeDescription
vid / volume-idstringVolume UUID or name. Omit to report every volume.

Response: 200 OK — a JSON object keyed by volume ID; each value is that volume’s array of session objects (empty if it has no clients). A specified volume yields just that one; omitting it yields all. Each session object:

FieldTypeDescription
idstringSession UUID
remote_addrstringClient remote address
local_addrstringServer-side local address
build_versionstringClient build version
proto_versionstringNegotiated protocol version
commandstringClient command line
kernelstringClient kernel version
cpusuint32Client CPU count
ramuint64Client RAM in bytes
uiduint32Client user ID
giduint32Client group ID
startedstringSession start time
blocks_readuint64Blocks read this reporting period
blocks_writtenuint64Blocks written this reporting period
bytes_readuint64Bytes read this reporting period
bytes_writtenuint64Bytes written this reporting period

Fields with zero or empty values are omitted. The read/write counters reflect the current reporting period and reset periodically.

GET /size-bins

Returns the distribution of files across logarithmic size bins.

ParameterTypeDescription
vid / volume-idstringVolume UUID or name. Omit to report every open volume.

Response: 200 OK — a JSON object keyed by volume ID; each value maps size-bin index (074) to file count. A specified volume yields just that one; omitting it yields all open volumes.

GET /missing-objects

Scans block keys and reports any whose backing object is absent from the block store. Each key is verified with a HEAD against the block store.

ParameterTypeDefaultDescription
vid / volume-idstringVolume UUID or name. Omit to scan every open volume.
live-onlyboolfalseRestrict the scan to live block keys
retired-onlyboolfalseRestrict the scan to retired block keys (mutually exclusive with live-only)
concurrencyint32Number of parallel HEAD requests

Response: 200 OK — a JSON object keyed by volume ID; each value is that volume’s array of entries (empty if none). A specified volume yields just that one; omitting it yields all open volumes. Each entry has kind (missing or error), ino, idx, retired, key, and error (error entries only). In all-volumes mode, a volume whose scan fails (e.g. one already running) is logged and skipped rather than failing the request.

StatusMeaning
200Scan ran; results returned keyed by volume ID.
400An invalid parameter: unresolvable volume, live-only and retired-only both set, or a malformed concurrency/boolean value.
409A single-volume scan was requested and one is already in progress for it.
500A single-volume scan failed.
GET /verify

Runs a read-only integrity check of a volume’s metadata (attr, block-key, and dentry scans plus counter comparisons). This endpoint never modifies data; use the offline CLI (meta.flexfs verify --fix) to repair.

ParameterTypeDescription
vid / volume-idstringVolume UUID or name. Omit to verify all open volumes.

Response: 200 OK — a JSON object keyed by volume ID; each value is that volume’s VerifyReport (per-scan counts plus an overall ok boolean). A specified volume yields just that one; omitting it yields all open volumes.

GET /metrics

Returns Prometheus-format metrics for the metadata server.

GET /status

Returns server health status.

POST /backup
Authorization: Bearer $META_TOKEN

Writes a consistent, point-in-time checkpoint of one or all volumes into a staging directory while the server keeps running. The staging directory is safe to rsync offsite. See Maintenance → Online backup for the recommended workflow.

$META_TOKEN is the metadata server’s token (the UUID configured with meta.flexfs init creds).

ParameterTypeDefaultDescription
deststring<dbFolder>/.backupStaging directory for the checkpoint. Must be on the same filesystem as --dbFolder for hard-linking, and must not be or contain the data directory.
vid / volume-idstringA single volume UUID or name. Omit to checkpoint all open volumes.
blockingboolfalseWait for the checkpoint and return a summary. See the maintenance note above.

Response: with blocking=true, 200 OK and body checkpointed N volume(s) (the count distinguishes a real backup from a no-op, e.g. zero open volumes). Otherwise 202 Accepted, no body.

StatusMeaning
200(blocking=true) Checkpoint completed; body reports the number of volumes written.
202Checkpoint started in the background.
400The vid / volume-id value could not be resolved to a volume.
401Missing or invalid bearer token.
409(async only) A conflicting checkpoint is already in progress.
500Checkpoint failed, or (either mode) dest is or contains the data directory.

Example — an automated backup that must fail loudly waits for completion (-f fails on non-2xx; self-signed cert, so -k):

Terminal window
curl -fk -X POST \
-H "Authorization: Bearer $META_TOKEN" \
"https://<meta-host>:443/backup?blocking=true"
POST /compact
Authorization: Bearer $META_TOKEN

Triggers a manual compaction of the metadata database for one or all volumes.

ParameterTypeDefaultDescription
vid / volume-idstringA single volume UUID or name. Omit to compact all open volumes.
blockingboolfalseWait for the compaction and return a summary. See the maintenance note above.

Response: with blocking=true, 200 OK and body compacted N volume(s). Otherwise 202 Accepted, no body.

StatusMeaning
200(blocking=true) Compaction completed; body reports the number of volumes compacted.
202Compaction started in the background.
400The vid / volume-id value could not be resolved to a volume.
401Missing or invalid bearer token.
409(async only) A conflicting compaction is already in progress.
500(blocking=true) Compaction failed.
POST /scrub
Authorization: Bearer $META_TOKEN

Retires leaked past-EOF block keys for one or all volumes.

ParameterTypeDefaultDescription
vid / volume-idstringA single volume UUID or name. Omit to scrub all open volumes.
blockingboolfalseWait for the scrub and return a summary. See the maintenance note above.

Response: with blocking=true, 200 OK and body retired N leaked block key(s): M inode(s) affected, K volume(s) skipped. Otherwise 202 Accepted, no body.

StatusMeaning
200(blocking=true) Scrub completed; body reports the counts.
202Scrub started in the background.
400The vid / volume-id value could not be resolved to a volume.
401Missing or invalid bearer token.
409(async only) A conflicting scrub is already in progress.
500(blocking=true) Scrub failed.
POST /reconcile
Authorization: Bearer $META_TOKEN

Checks that every object in the block store is accounted for in the metadata store and removes any that are not.

ParameterTypeDefaultDescription
vid / volume-idstringA single volume UUID or name. Omit to reconcile all open volumes. When set, objects belonging to other volumes sharing the same block store are left untouched.
blockingboolfalseWait for the reconciliation and return a summary. See the maintenance note above.

Response: with blocking=true, 200 OK and body reconciled N object(s): M deleted, K marked for deletion. Otherwise 202 Accepted, no body.

StatusMeaning
200(blocking=true) Reconciliation completed; body reports the counts.
202Reconciliation started in the background.
400The vid / volume-id value could not be resolved to a volume.
401Missing or invalid bearer token.
409(async only) A conflicting reconciliation is already in progress.
DELETE /locks
Authorization: Bearer $META_TOKEN

Deletes held file locks for a volume, optionally scoped to a single inode — the DELETE verb on the /locks resource that GET lists.

ParameterTypeDefaultDescription
vid / volume-idstringVolume UUID or name (required)
inouint640Inode to scope the deletion to. 0 or omitted deletes all locks in the volume.

Response: 200 OK with a plain-text body deleted N lock(s).

StatusMeaning
200Locks deleted; body reports the count.
400Missing/unresolvable volume, or an invalid ino.
401Missing or invalid bearer token.
500Deletion failed.