# zfsdu - ZFS Disk Usage A ncdu-like TUI application for ZFS with snapshot management. Navigate your ZFS pools, datasets, and volumes in a tree view, and manage snapshots interactively. ![License](https://img.shields.io/badge/license-CDDL-blue.svg) ## Quick Install ```bash curl -sSL https://gitlab.datazone.de/kidev/zfsdu/-/raw/main/install-binary.sh | sudo bash ``` ## Features - **Tree View**: Hierarchical display of ZFS pools, datasets, and volumes - **Expand/Collapse**: Navigate the tree structure interactively - **Snapshot Management**: Mark and delete multiple snapshots at once - **Size Visualization**: Bar graphs showing relative sizes - **Date Column**: Shows creation date of datasets and snapshots - **Search**: Find datasets or snapshots by name - **Filter**: Filter the view to show only matching items - **Bulk Selection**: Select/unselect all visible snapshots (like Midnight Commander) - **Sorting**: Toggle between Size/Date/Name sorting - **Dry-Run Mode**: Preview deletions without actually deleting - **Auto-Refresh**: Automatically refresh the view periodically - **Mouse Support**: Click to select, scroll wheel to navigate, right-click to mark - **Configurable Colors**: Customize the UI via config file - **MC-Style UI**: Classic Midnight Commander look and feel ## Screenshot ``` zfsdu [Sort: Size] ┌─────────────────────────────────────────────────────────────────────────────┐ │ Name Date Size │ │─────────────────────────────────────────────────────────────────────────────│ │ ▾ rpool 2024-01-01 500.0G █████ │ │ ├──▾ ROOT 2024-01-01 120.0G ██ │ │ │ ├── pve-1 2024-01-15 80.0G █ │ │ │ └──○ @autosnap_2024-01-15 2024-01-15 12.0G │ │ └──▸ data 2024-01-01 380.0G ████ │ │ ▸ tank 2023-12-01 2.0T █████ │ ├─────────────────────────────────────────────────────────────────────────────┤ │ 2 marked (45.5G) │ └─────────────────────────────────────────────────────────────────────────────┘ ? Help s Sort D Dry a Auto / Find f Filt d Del q Quit ``` ## Installation ### Binary (recommended) ```bash curl -sSL https://gitlab.datazone.de/kidev/zfsdu/-/raw/main/install-binary.sh | sudo bash ``` ### Build from Source ```bash # Install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source ~/.cargo/env # Clone and build git clone https://gitlab.datazone.de/kidev/zfsdu.git cd zfsdu cargo build --release # Install sudo cp target/release/zfsdu /usr/local/bin/ ``` ## Usage ```bash zfsdu ``` ### Keyboard Shortcuts | Key | Action | |-----|--------| | **Navigation** | | | ↑/k, ↓/j | Move up/down | | Enter/→/l | Expand/collapse dataset | | Home/End | First/last item | | PgUp/PgDn | Page up/down | | Mouse scroll | Scroll list | | Left-click | Select item | | Right-click | Toggle mark | | **Tree** | | | e | Expand all | | c | Collapse all | | **Selection** | | | Space | Mark/unmark snapshot | | + | Select all visible snapshots | | - | Unselect all visible snapshots | | * | Invert selection | | **Search & Filter** | | | / | Search (n=next, N=prev) | | f | Filter visible items | | Esc | Clear filter | | **Sort & View** | | | s | Toggle sort: Size/Date/Name | | D | Toggle dry-run mode | | a | Toggle auto-refresh (30s) | | **Actions** | | | d / F8 | Delete marked snapshots (2x to confirm) | | r / F5 | Refresh | | ? / F1 | Help | | q / F10 | Quit | ## Configuration Create `~/.config/zfsdu/config.toml` to customize colors: ```toml # Auto-refresh interval in seconds (0 to disable) auto_refresh_interval = 30 [colors] # Available: black, red, green, yellow, blue, magenta, cyan, white # Light: lightred, lightgreen, lightyellow, lightblue, lightmagenta, lightcyan # Also: gray, darkgray background = "blue" foreground = "white" header = "yellow" selected_bg = "cyan" selected_fg = "black" marked = "yellow" snapshot = "lightcyan" size = "lightgreen" tree = "darkgray" search_match = "lightred" ``` ## Requirements - Linux with ZFS installed - Terminal with UTF-8 support - Root privileges (for snapshot deletion) ## License CDDL (Common Development and Distribution License) - same as OpenZFS. See [LICENSE](LICENSE) for details.