86 lines
2.3 KiB
Markdown

# PVE Storage Manager TUI
Python Textual-based TUI for managing ZFS snapshots and LXC mountpoints on Proxmox VE.
## Features
- **Snapshots tab** — List, create, delete, rollback ZFS snapshots across all pools
- **Schedules tab** — Set up auto-snapshot cron jobs per dataset with auto-pruning (keep last N)
- **Datasets tab** — View all ZFS datasets with usage info
- **LXC Mounts tab** — View, add, and remove mountpoints for LXC containers
## Installation
Run on **Proxmox host as root**.
### 1. Install dependencies
```bash
apt update
apt install -y python3-pip
pip3 install textual --break-system-packages
```
### 2. Copy the script
```bash
# Copy pve_tui.py to the Proxmox host, then:
chmod +x /root/pve_tui.py
```
### 3. Run
```bash
python3 /root/pve_tui.py
```
### Optional: make it a command
```bash
cp /root/pve_tui.py /usr/local/bin/pve-tui
chmod +x /usr/local/bin/pve-tui
```
Then just run `pve-tui` from anywhere.
## Keybindings
| Key | Action |
|-----|--------|
| `q` | Quit |
| `r` | Refresh current view |
| `n` | New snapshot |
| `d` | Delete selected snapshot |
| `s` | Add schedule |
| `Tab` / arrow keys | Navigate tabs |
| `↑` / `↓` | Move selection in table |
## How Scheduling Works
When you create a schedule, the tool:
1. Installs a helper script at `/usr/local/bin/pve-tui-snapshot.sh`
2. Adds a cron entry in root's crontab between markers:
```
# === PVE-TUI AUTO SNAPSHOT BEGIN ===
0 3 * * * /usr/local/bin/pve-tui-snapshot.sh RAID1_1TB 7
# === PVE-TUI AUTO SNAPSHOT END ===
```
3. On each run, creates `DATASET@auto-YYYYMMDD-HHMMSS` and prunes
oldest `auto-*` snapshots beyond the "keep last N" limit.
Manual snapshots (any name not starting with `auto-`) are **never** auto-pruned.
## Safety Notes
- **Rollback** destroys all newer snapshots. Always double-check before confirming.
- **LXC mount changes** may require the container to be stopped (Proxmox will warn).
- Crontab is only modified inside the marker block — your other cron entries are untouched.
- The script uses `zfs`, `pct`, and `crontab` — no third-party ZFS tools required.
## Troubleshooting
- **"No datasets found"** → check `zfs list` works as root
- **Cron not running** → check `systemctl status cron` and `/var/log/syslog`
- **Textual rendering issues** → use a modern terminal (Alacritty, iTerm2, Windows Terminal)