Skip to content

dedup.flexfs

dedup.flexfs identifies duplicate files within a flexFS volume and optionally replaces them with hard links to reclaim storage. It fetches duplicate candidates from the metadata server’s /duplicates endpoint, then verifies them through checksum comparison and byte-for-byte validation before making any changes.

Terminal window
dedup.flexfs [flags] [path]

If no path is specified, the current directory is used. The path must be within a flexFS mount.

FlagTypeDefaultDescriptionVisibility
--fixboolfalseReplace duplicates with hard links (requires root)Public
--maxBlocksuint640Maximum blocks filter (0 = no limit)Public
--maxSizeuint640Maximum byte size filter (0 = no limit)Public
--minBlocksuint640Minimum blocks filterPublic
--minSizeuint640Minimum byte size filterPublic
--noMetaSSLboolfalseDisable SSL for metadata server connectionsInternal
  1. Candidate Discovery: Queries the metadata server for files that share the same size and block count.
  2. Checksum Grouping: For groups of 3+ files, computes xxhash64 checksums concurrently to sub-group candidates. For pairs, this step is skipped.
  3. Byte Verification: Performs a byte-for-byte comparison of each candidate against the retained file.
  4. Retention Heuristic: The file with the lowest birth time (oldest) is retained. Ties are broken by highest hard link count.
  5. Hard Link Replacement (with --fix): Atomically replaces each duplicate with a hard link to the retained file.

Scan a directory for duplicates (dry run):

Terminal window
dedup.flexfs /mnt/flexfs/data

Fix duplicates by replacing them with hard links:

Terminal window
sudo dedup.flexfs --fix /mnt/flexfs/data

Only scan files with at least 2 blocks and at most 100 blocks:

Terminal window
dedup.flexfs --minBlocks 2 --maxBlocks 100 /mnt/flexfs/data
  • The path must be within an active flexFS mount.
  • --fix requires root privileges.
  • --fix is not supported on time-travel mounts.