Skip to main content

CLI + TUI disk manager with SMART, LUKS, and non-blocking automount

Project description

diskman

PyPI version License: MIT Python 3.9+

diskman is a lightweight, terminal-first Linux disk and partition manager. It provides a powerful CLI and an interactive TUI for day-to-day storage administration, featuring SMART health monitoring, LUKS encryption support, and filesystem-aware automounting.


🚀 Key Features

  • Dual Interface: Full-featured Command Line Interface (CLI) and an interactive Terminal User Interface (TUI).
  • Smart Automount: Filesystem-aware mount options (e.g., discard for SSDs, UID/GID mapping for FAT/NTFS).
  • LUKS Support: Auto-detection, unlocking, and locking of encrypted partitions.
  • Health Monitoring: Real-time SMART health status visibility (via smartmontools).
  • Safety First: Automatically excludes root partitions from destructive operations and provides a read-only fallback if a writable mount fails.
  • Non-Blocking Ops: Asynchronous mount, unmount, and LUKS operations to keep the TUI responsive.
  • Persistence: Easily toggle reboot-persistent mounts via tagged /etc/fstab entries.
  • System Integration: Ready-to-use systemd service and timer for periodic automounting.

📦 Installation

From PyPI (Recommended)

Install the latest stable version directly from PyPI:

python3 -m pip install --upgrade diskman

From Source

git clone https://github.com/SoyalIslam/disk-manager.git
cd disk-manager
python3 -m pip install .

Requirements

  • OS: Linux
  • Python: 3.9+
  • System Tools: util-linux (lsblk, findmnt, mount, umount)
  • Optional Tools:
    • cryptsetup (for LUKS support)
    • smartmontools (for SMART health monitoring)

🛠 Usage

CLI Reference

Command Description
diskman list List all partitions, filesystems, and mount status.
diskman tui Launch the interactive Terminal User Interface.
sudo diskman automount Auto-mount all available partitions (excluding root).
sudo diskman mount /dev/sdb1 Mount a specific device (prompts for LUKS if needed).
sudo diskman umount /dev/sdb1 Unmount a specific device.
sudo diskman luks-unlock /dev/sdb2 Unlock a LUKS encrypted partition.
sudo diskman boot-add /dev/sdb1 Enable reboot-persistent mount in /etc/fstab.

Note: Operations that modify system state (mount/unmount/LUKS/fstab) require sudo.

TUI Controls

Launch with diskman tui (or sudo diskman tui for full functionality):

  • j / k or Arrow Keys: Navigate device list.
  • m: Mount or unmount the selected partition.
  • u / l: Unlock or lock a LUKS partition.
  • a: Trigger a background automount of all devices.
  • p: Toggle persistence (/etc/fstab) for the selected device.
  • r: Refresh the device list.
  • q: Exit.

⚙️ System Integration

Periodic Automount (systemd)

You can automate mounting of external drives using the provided systemd units:

  1. Install Units:

    sudo install -Dm644 extras/systemd/diskman-automount.service /etc/systemd/system/
    sudo install -Dm644 extras/systemd/diskman-automount.timer /etc/systemd/system/
    
  2. Enable Timer:

    sudo systemctl daemon-reload
    sudo systemctl enable --now diskman-automount.timer
    

🏗 Development

Setup Environment

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt

Build & Package

# Build distribution archives
python3 -m build

# Build standalone binary (via PyInstaller)
./scripts/build_binary.sh

GitHub Actions: Publish to PyPI

This repo includes:

  • .github/workflows/publish-pypi.yml

Set these repository secrets in GitHub:

  • PYPI_API_TOKEN
  • TEST_PYPI_API_TOKEN

Workflow usage:

  1. Manual publish to TestPyPI:
    • Actions -> Publish Python Package -> Run workflow -> target testpypi
  2. Manual publish to PyPI:
    • Actions -> Publish Python Package -> Run workflow -> target pypi
  3. Auto publish to PyPI on tag:
    • Push tag vX.Y.Z matching pyproject.toml version
git tag v0.2.1
git push origin v0.2.1

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diskman-0.2.1.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diskman-0.2.1-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file diskman-0.2.1.tar.gz.

File metadata

  • Download URL: diskman-0.2.1.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Garuda Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for diskman-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1d5a4143690fc946d60424fcc15747427a0ccc6a647b5989d4c75752a48da216
MD5 eb5c00b168d6ad9afc5d0581ee9e721e
BLAKE2b-256 9cc362c37eb4bf07ecf188db657d6896523cac1ff7964c94e72ecb34211e41b9

See more details on using hashes here.

File details

Details for the file diskman-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: diskman-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Garuda Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for diskman-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1e7acf8e89c03248a0df48b3e53b16b453fa421acb84c87e1dbf861e89fe4317
MD5 ab40832387584113e42c5f84cc25f7cd
BLAKE2b-256 8dd68180e2078977c2f8fb970847de1250bad74793c443b59515ebf74c10c3f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page