Skip to main content

Synology Disk Usage

@svendowideit/synology-disk-usagev2026.10.25.1beta· MIT· 1d agoBEHAVIORSREPORTSACCEPTED WARNINGS
01README

IMPORTANT — LONG-RUNNING SCAN

Inventorying a NAS disk can take a long time: minutes on a small volume, hours on a large one. The default tree mode runs one du per volume and is the safest starting point. Use --input mode=shares for a quick share-level answer, and reserve --input mode=files for when you need exact per-file categories.

Answers "what is using my Synology NAS space?" and separates Docker images, Synology app data, Google Drive/Photos backups, ordinary backups, recycle bins, user files, and media — instead of showing one opaque volume total. WHAT IT DOES

SSHes into a Synology DSM host, auto-discovers its volumes and top-level shares, then runs a fast du directory-tree scan (or an optional per-file walk) and groups usage into Synology-specific buckets. It understands @docker (Container Manager), @appstore/@synologydrive/ @cloudsync and other @ app-data directories, Google Drive and Google Photos sync folders, Hyper Backup / Active Backup / Time Machine destinations, #recycle bins, homes, and media libraries. The default du -d3 scan runs on the NAS and sends one line per directory, so a 100 TB volume does not stream millions of file paths over SSH. Prefer it over a generic du report: it tells you which category owns the bytes, not just which folder.

INSTALL

swamp extension pull @svendowideit/synology-disk-usage

DEPENDENCIES

An OpenSSH client on the machine running swamp, and key/agent SSH access to the NAS (password prompts are disabled). No DSM admin API account, no package installed on the NAS, and no other swamp extension is required.

RUN

# Create the model once with the NAS SSH target.
swamp model create @svendowideit/synology-disk-usage nas \
  --global-arg host=admin@diskstation

# Verify SSH, persist the settings, and discover volumes.
swamp model method run nas setup

# Default tree audit: one du -d3 per volume, classifying large dirs.
swamp model method run nas audit

# Exact per-file walk when you need file-extension/content categories.
swamp model method run nas audit --input mode=files

# Lightest audit: one du per top-level share.
swamp model method run nas audit --input mode=shares

# Read root-only @docker/@appstore data via sudo -n (NOPASSWD required).
swamp model method run nas audit --input useSudo=true

CONFIGURE

Global arguments (set with --global-arg): host, sshUser, identityFile, sshPort, volumes (empty auto-detects /volume[0-9]*), categories (custom path rules; empty uses the Synology defaults), excludePatterns (regexes to skip), minNotableBytes (default 1 GiB), maxFiles (0 = unlimited), timeoutMs (0 = none), useSudo (default false; run remote find/du through sudo -n to read root-only app data and Docker storage; needs NOPASSWD for those two binaries and the error prints the exact sudoers line and install command), and oneFilesystem (default false; cross Synology shared-folder subvolumes/mounts so homes, photo, and GoogleDrive are measured; true adds -x/-xdev), and treeDepth (default 3; directory depth for the du tree scan).

Every audit also reports scanned-vs-used coverage and lists discovered shares with no readable files, so a permission-limited scan is visible instead of looking like the whole NAS. Override scan settings per run with --input (for example mode, treeDepth, useSudo, oneFilesystem, categories, excludePatterns, minNotableBytes, maxFiles, timeoutMs).

SETUP

setup persists every supplied value, reads the saved config back before asking again, verifies the real SSH connection, and records the detected model, DSM version, and volumes. Supplied values are saved even when incomplete; a failed connection is written to the config resource and the method stops with the SSH error rather than claiming success.

UPGRADE

This extension installs nothing on the host, so the upgrade is automated in place by updating the package:

  swamp extension update @svendowideit/synology-disk-usage

WHAT IT INSTALLS

Nothing on the host — no services, daemons, cron jobs, or webhooks. It opens SSH sessions, runs read-only find/du/df commands, and writes swamp resources.

02Behaviors1
@svendowideit/synology-disk-usagev2026.10.25.1synology_disk_usage.ts

Global Arguments

ArgumentTypeDescription
host?stringSSH target for the NAS, e.g. admin@diskstation or just diskstation
sshUser?stringSSH user when host has no user@ prefix
identityFile?stringSSH private key path (optional; key/agent auth only)
sshPort?numberSSH port (optional)
volumes?arrayVolume paths to scan; empty auto-detects /volume[0-9]*
categories?arrayCustom path category rules; empty uses the Synology defaults
excludePatterns?arrayCase-insensitive regexes for paths to skip (e.g. '/@eaDir/')
minNotableBytes?numberMinimum size for an item to be called notable (default 1 GiB)
maxFiles?numberStop after this many files; 0 scans everything
timeoutMs?numberSSH command timeout in milliseconds; 0 means no timeout
useSudo?booleanRun remote scan commands through sudo -n (needed for root-only @docker/@appstore on many NAS setups)
oneFilesystem?booleanStay on the volume's root filesystem; false (default) crosses Synology shared-folder subvolumes and mounts
treeDepth?numberDirectory depth for the fast du-based tree scan (default 3)
fn setup(host?: string, sshUser?: string, identityFile?: string, sshPort?: number, volumes?: array)
Persist SSH settings, verify the connection, and discover volumes
ArgumentTypeDescription
host?stringOverride the SSH target
sshUser?stringOverride the SSH user
identityFile?stringOverride the SSH key path
sshPort?numberOverride the SSH port
volumes?arrayOverride the volume paths; empty keeps the existing/auto-detected set
fn discover(host?: string, sshUser?: string, volumes?: array)
List volumes, capacities, and top-level shares without a full scan
ArgumentTypeDescription
host?stringOverride the SSH target for this run
sshUser?stringOverride the SSH user
volumes?arrayOverride the volume paths for this run
fn audit(host?: string, sshUser?: string, volumes?: array, mode?: enum, treeDepth?: number, useSudo?: boolean, oneFilesystem?: boolean, categories?: array, excludePatterns?: array, minNotableBytes?: number, maxFiles?: number, timeoutMs?: number)
Walk the NAS and report disk usage by Synology-aware category
ArgumentTypeDescription
host?stringOverride the SSH target for this run
sshUser?stringOverride the SSH user
volumes?arrayOverride the volume paths for this run
mode?enumtree uses du -d<treeDepth> for a fast lay-of-the-land; files streams every file for exact content categories; shares uses du per share
treeDepth?numberOverride the du tree depth for this call (default 3)
useSudo?booleanRun remote find/du through sudo -n for this call (NOPASSWD required)
oneFilesystem?booleanLimit the walk to the volume's root filesystem; false crosses shared-folder subvolumes
categories?arrayOverride the path category rules for this call
excludePatterns?arrayOverride the path exclusion regexes for this call
minNotableBytes?numberOverride the notable-size threshold for this call
maxFiles?numberOverride the file cap for this call; 0 means unlimited
timeoutMs?numberOverride the command timeout for this call; 0 means none

Resources

config(infinite)— Persisted SSH connection and volume configuration
discovery(infinite)— Volumes, capacities, and top-level shares on the NAS
audit(infinite)— Categorized disk usage for the NAS
03Reports1
@svendowideit/synology-disk-reportmethod
synology_disk_usage_report.ts

Format Synology disk usage as a category, capacity, and largest-item summary

synologydisksummary
04Stats
A
93 / 100
Downloads
2
Archive size
45.0 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit1/2partial
    • @std/assert--jsr:@std/assert@1 is a range; audited 1.0.19, the version the registry resolved
    1 dependency found
    • jsr:@std/assert@1 -- audited 1.0.19
  • Docs keep secrets in a vault1/1earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License2/2earned
  • Verified public repository2/2earned

06Platforms