A TUI (Text User Interface) tool for synchronizing ZFS datasets between servers using snapshots. This tool is designed to make it easy to keep your ZFS datasets in sync, with a focus on Plex media libraries.
- Interactive TUI interface for easy configuration and monitoring
- Integration with sanoid for snapshot management
- Support for resuming interrupted transfers
- Configurable synchronization options
- Save and load configurations for different sync scenarios
- Progress monitoring and logging
- SSH connection management for remote servers
- Python 3.7 or higher
- ZFS filesystem
- sanoid/syncoid (included in the libs directory)
- SSH access to remote servers (if syncing to remote servers)
-
Clone the repository:
git clone https://github.com/yourusername/zfs_sync.git cd zfs_sync
-
Make the start script executable:
chmod +x start.sh
-
Run the setup:
./start.sh --setup
This will:
- Create a virtual environment
- Install required dependencies
- Initialize a git repository
- Create default configurations
Before using the tool, you can run the comprehensive test script to verify that everything is set up correctly:
./test.sh
This will:
- Check prerequisites
- Set up the environment
- Test job management
- Verify the application functionality
- Write detailed logs to
~/.zfs_sync/logs/
-
Start the application:
./start.sh
-
Use the TUI to:
- Select the source dataset
- Configure the destination server
- Select the destination dataset
- Configure synchronization options
- Start the synchronization process
- Monitor progress
The tool supports creating and managing sync jobs:
# Create a new job
./start.sh --create-job media_backup
# Edit an existing job
./start.sh --edit-job media_backup
# Run a job
./start.sh --run-job media_backup
# List all jobs
./start.sh --list-jobs
# Schedule a job via cron
./start.sh --schedule-job media_backup
# View scheduled jobs
./start.sh --list-schedules
If you're setting up the tool for the first time:
# Run the setup
./start.sh --setup
This will:
- Create a virtual environment
- Install required dependencies
- Initialize a git repository
- Create default configurations
s
: Start synchronizationc
: Save configurationr
: Refreshq
: Quitd
: Toggle dark modeh
: Show help
The application stores its configuration in ~/.zfs_sync/config.json
. This includes:
- Default source dataset
- Default destination server
- Default destination dataset
- Synchronization options
- Saved configurations
This tool integrates with sanoid for snapshot management. Sanoid is included in the libs/sanoid
directory.
To use sanoid:
- Configure sanoid in
~/.zfs_sync/sanoid.conf
- Enable sanoid integration in the application settings
zfs_sync/
├── libs/
│ └── sanoid/ # Sanoid/syncoid tools
├── src/
│ └── zfs_sync/
│ ├── core/ # Core functionality
│ ├── tui/ # TUI interface
│ └── main.py # Entry point
├── start.sh # Main script for setup and running
├── test.sh # Comprehensive test script
└── README.md # This file
zfs_ops.py
: ZFS operationsssh_ops.py
: SSH operationssanoid_ops.py
: Sanoid integrationconfig_manager.py
: Configuration management
app.py
: Main TUI applicationscreens/
: Screen definitionswidgets/
: Custom widgets
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the GPL v3 License - see the LICENSE file for details.
- sanoid/syncoid for ZFS snapshot management
- Textual for the TUI framework