Skip to content

VOLUME.ADMIN CLEANUP-ORPHAN-FILES

Identifies and removes orphaned segment files from a volume’s data directory that are no longer tracked in metadata.

VOLUME.ADMIN CLEANUP-ORPHAN-FILES <volume-name>
ParameterTypeDescription
volume-namestringName of the volume to clean up (e.g. bucket-shard-0)

Array of bulk strings, each containing the absolute path of a deleted orphan file. Returns an empty array if no orphan files were found.

Loads volume metadata and builds a set of expected segment file names, then lists the actual files present in the volume’s segments/ directory on disk. Any file on disk that is not in the expected set is considered an orphan and is deleted. The absolute paths of successfully deleted files are returned.

Orphan segment files remain on disk after crashes where the metadata entry was removed, but the file was not deleted.

It is available on the management port (default 3320).

ConditionMessage
Missing volume name parameterERR invalid number of parameters
No volume with that name is managed by this memberERR Volume: '<name>' is not open
Volume is closedERR Volume <name> is closed.
Segments directory not foundERR File not found: <path>

Orphan files found and deleted:

127.0.0.1:3320> VOLUME.ADMIN CLEANUP-ORPHAN-FILES bucket-shard-0
1) "/var/kronotop/data/bucket-shard-0/segments/00000a.seg"
2) "/var/kronotop/data/bucket-shard-0/segments/00000b.seg"

No orphan files:

127.0.0.1:3320> VOLUME.ADMIN CLEANUP-ORPHAN-FILES bucket-shard-0
(empty array)

Volume not found:

127.0.0.1:3320> VOLUME.ADMIN CLEANUP-ORPHAN-FILES non-existent-volume
(error) ERR Volume: 'non-existent-volume' is not open