Scan file-system storage, record results in a database, and serve a live web UI.
Project description
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/ioniceto 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) ioniceandnice(optional; only needed if you use the--ionice-class/--niceflags)
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file storage_usage-0.2.0.tar.gz.
File metadata
- Download URL: storage_usage-0.2.0.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b6a5337aba79d999ea8b4786a0b06260bdf265f4a37bbdf3fa6815835e7d0a5
|
|
| MD5 |
5762e6eeed541fcfc1ca6d28fabdaa98
|
|
| BLAKE2b-256 |
67b9c303d420d4eed5b878f446dc256f6105189ba17b1fd621b46a06a5c4d162
|
Provenance
The following attestation bundles were made for storage_usage-0.2.0.tar.gz:
Publisher:
publish-to-pypi.yaml on stevenstetzler/storage-usage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
storage_usage-0.2.0.tar.gz -
Subject digest:
9b6a5337aba79d999ea8b4786a0b06260bdf265f4a37bbdf3fa6815835e7d0a5 - Sigstore transparency entry: 1150306042
- Sigstore integration time:
-
Permalink:
stevenstetzler/storage-usage@cf86fa4c463b123c5f7f6e1d9e6535ddeaa90e2b -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/stevenstetzler
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yaml@cf86fa4c463b123c5f7f6e1d9e6535ddeaa90e2b -
Trigger Event:
release
-
Statement type:
File details
Details for the file storage_usage-0.2.0-py3-none-any.whl.
File metadata
- Download URL: storage_usage-0.2.0-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a060e382b74e6e4de4a50e99ef54a214483139673d5bc2b97cd81376f2bbd29
|
|
| MD5 |
88498d2908d349ddcf4c3b7ebade6f0d
|
|
| BLAKE2b-256 |
c9d2a70882cda9a4d15c935ab5cdc73a2c6d36c5be3a445ae39724543fec42ba
|
Provenance
The following attestation bundles were made for storage_usage-0.2.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yaml on stevenstetzler/storage-usage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
storage_usage-0.2.0-py3-none-any.whl -
Subject digest:
9a060e382b74e6e4de4a50e99ef54a214483139673d5bc2b97cd81376f2bbd29 - Sigstore transparency entry: 1150306112
- Sigstore integration time:
-
Permalink:
stevenstetzler/storage-usage@cf86fa4c463b123c5f7f6e1d9e6535ddeaa90e2b -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/stevenstetzler
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yaml@cf86fa4c463b123c5f7f6e1d9e6535ddeaa90e2b -
Trigger Event:
release
-
Statement type: