Skip to main content

storage-usage

A command-line tool that recursively scans a directory tree, records the storage used by each file owned by a given user into a database, and optionally serves a live web UI to browse and filter those results.


Features

  • Scans any path on the file system and records per-file sizes together with aggregate directory sizes.
  • Filters results by file owner (defaults to the current user).
  • Stores data in any SQLAlchemy-supported database (defaults to a local SQLite file).
  • Resumes interrupted scans automatically – directories already fully scanned are skipped.
  • Runs with reduced CPU and I/O priority via nice/ionice to avoid disturbing other workloads.
  • Generates a standalone HTML summary report of the database contents.
  • Serves a browser-based web UI with pagination and filtering over any previously built database.

Requirements

  • Python 3.10 or later
  • The packages listed in requirements.txt (Jinja2, SQLAlchemy)
  • ionice and nice (optional; only needed if you use the --ionice-class / --nice flags)

Installation

Install from PyPI:

pip install storage-usage

Or install directly from GitHub using pip:

pip install git+https://github.com/stevenstetzler/storage-usage.git

This installs the storage-usage command and all required dependencies.

Development installation

Clone the repository and install in editable mode:

git clone https://github.com/stevenstetzler/storage-usage.git
cd storage-usage
pip install -e .

Usage

storage-usage [--user USER] [--db URL]
              [--summary-html FILE]
              [--nice N] [--ionice-class {1,2,3}] [--ionice-level {0..7}]
              PATH

storage-usage --serve [--port PORT] [--db URL]

Scan mode

Scan a directory tree and persist the results to a database:

storage-usage /path/to/scan

Scan a path for files owned by a specific user and write results to a named database:

storage-usage --user alice --db sqlite:///alice.db /home/alice

Generate an HTML summary after scanning:

storage-usage /data --summary-html report.html

Run the scan at reduced priority so it does not affect other processes:

storage-usage --nice 19 --ionice-class 3 /data

Serve mode

Start the web UI to browse a previously built database:

storage-usage --serve

Use a specific database and port:

storage-usage --serve --db sqlite:///alice.db --port 9090

Open http://localhost:8080/ (or whichever port you chose) in your browser.


Options

Option Description
PATH Root directory to scan (required in scan mode).
--user USER Only count files owned by USER. Defaults to the current user.
--db URL SQLAlchemy database URL. Defaults to sqlite:///storage_usage.db.
--summary-html FILE After scanning, write a standalone HTML summary to FILE.
--serve Start the web UI instead of scanning. PATH is not required.
--port PORT Port for the web UI (default: 8080).
--nice N Run the scan under nice -n N (0–19). Higher values mean lower CPU priority.
--ionice-class {1,2,3} I/O scheduling class: 1 = realtime (requires root), 2 = best-effort, 3 = idle.
--ionice-level {0..7} Priority level within the chosen I/O class (0 = highest, 7 = lowest).

Web UI API

When running in --serve mode the server exposes two JSON endpoints in addition to the HTML UI:

Endpoint Description
GET / Single-page HTML application.
GET /api/files Paginated list of individual file records.
GET /api/dirs Paginated list of directory prefix records.

Both API endpoints accept the following query parameters:

Parameter Description
page 1-based page number (default 1).
per_page Records per page (default 20, max 100).
host Substring filter on the host identifier.
path Substring filter on the file path or directory prefix.
min_size Minimum file size in bytes (default: no minimum).

/api/files additionally accepts:

Parameter Description
kind Substring filter on the file type (file, symlink, directory, …).

Running the tests

pip install pytest
pytest tests/

License

See LICENSE.

Metadata

Release files for storage-usage 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for storage-usage 0.2.0
File Size Uploaded
storage_usage-0.2.0.tar.gz 29.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for storage-usage 0.2.0
File Interpreter ABI Platform
storage_usage-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 50.6 kB

Release files / storage_usage-0.2.0.tar.gz

Download URL storage_usage-0.2.0.tar.gz
Size 29.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9b6a5337aba79d999ea8b4786a0b06260bdf265f4a37bbdf3fa6815835e7d0a5
BLAKE2b-256 checksum
How to use checksums
67b9c303d420d4eed5b878f446dc256f6105189ba17b1fd621b46a06a5c4d162
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 20, 2026.

Transparency log

Release files / storage_usage-0.2.0-py3-none-any.whl

Download URL storage_usage-0.2.0-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a060e382b74e6e4de4a50e99ef54a214483139673d5bc2b97cd81376f2bbd29
BLAKE2b-256 checksum
How to use checksums
c9d2a70882cda9a4d15c935ab5cdc73a2c6d36c5be3a445ae39724543fec42ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 20, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page