CLI + TUI disk/partition manager with SMART, LUKS, mount controls, and partition operations
Project description
diskman
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.,
discardfor 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.
- Partition Management: Create and delete partitions from CLI with explicit filesystem selection (
ntfs3,btrfs,exfat,vfat, etc.) and optional custom volume labels. - Non-Blocking Ops: Asynchronous mount, unmount, and LUKS operations to keep the TUI responsive.
- Persistence: Easily toggle reboot-persistent mounts via tagged
/etc/fstabentries. - System Integration: Ready-to-use
systemdservice 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) - Partitioning Tools:
parted,partprobe,udevadm - Filesystem Tools:
mkfs.ntfs,mkfs.btrfs,mkfs.exfat,mkfs.vfat,mkfs.ext2,mkfs.ext3,mkfs.ext4,mkfs.xfs,mkfs.f2fs,mkfs.nilfs2,mkfs.reiserfs,mkudffs - 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 part-create /dev/sdb --fs ntfs --label DATA --size 100G |
Create and format a new partition in free disk space. |
sudo diskman part-delete /dev/sdb3 |
Delete an existing partition. |
sudo diskman part-merge /dev/sdb2 |
Merge adjacent right-side unallocated space into a partition. |
sudo diskman boot-add /dev/sdb1 |
Enable reboot-persistent mount in /etc/fstab. |
Note: Operations that modify system state (mount/unmount/LUKS/partition create-delete-merge/fstab) require sudo.
TUI Controls
Launch with diskman tui (or sudo diskman tui for full functionality):
j/kor 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.c: Create a new partition (prompts for disk, menu-select filesystem, label, size).d: Delete the selected partition (with confirmation prompt).g: Merge adjacent right-side unallocated space into the selected partition.r: Refresh the device list.q: Exit.
⚙️ System Integration
Periodic Automount (systemd)
You can automate mounting of external drives using the provided systemd units:
-
Install Units:
sudo install -Dm644 extras/systemd/diskman-automount.service /etc/systemd/system/ sudo install -Dm644 extras/systemd/diskman-automount.timer /etc/systemd/system/
-
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_TOKENTEST_PYPI_API_TOKEN
Workflow usage:
- Manual publish to TestPyPI:
- Actions ->
Publish Python Package->Run workflow-> targettestpypi
- Actions ->
- Manual publish to PyPI:
- Actions ->
Publish Python Package->Run workflow-> targetpypi
- Actions ->
- Auto publish to PyPI on tag:
- Push tag
vX.Y.Zmatchingpyproject.tomlversion
- Push tag
git tag v0.2.6
git push origin v0.2.6
📄 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
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 diskman-0.2.6.tar.gz.
File metadata
- Download URL: diskman-0.2.6.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4388d9615e0d74bd5d0e4c73b85d7b5537bae7ea80ca760056c340aedc374145
|
|
| MD5 |
94528981152846619d5a7fc85b32e8ac
|
|
| BLAKE2b-256 |
717f889a4d2a1ab25de8d80448b828422e9346d8937324db7fa6650f09dc11e3
|
File details
Details for the file diskman-0.2.6-py3-none-any.whl.
File metadata
- Download URL: diskman-0.2.6-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac134b3f41319b47cd311c850a895039d8d9eb87bc6cd03f3ccf883e999ab58d
|
|
| MD5 |
aaecb97b906eb04c8f1dc72628c4a3cc
|
|
| BLAKE2b-256 |
45ffd0faa50b9c8c864d892bf569fb7ac0f1354de731311922dc0efd25cc58b1
|