feat: Enhanced simple LVM backup system

- Add 3 backup modes: LV→LV, LV→Raw, VG→Raw
- Simple GUI with mode selection and dynamic target lists
- Command-line version with clear mode support
- Enhanced drive listing with mode-specific options
- Minimal logic: just snapshot → copy → cleanup
- No complex migration features that cause system issues
- Supports refreshing existing backups and creating fresh ones
This commit is contained in:
root
2025-10-09 00:27:34 +02:00
parent 56c07dbe49
commit 871a57947d
5 changed files with 1049 additions and 0 deletions

119
SIMPLE_BACKUP_README.md Normal file
View File

@@ -0,0 +1,119 @@
# Simple LVM Backup System
**A much simpler, safer approach to LVM backups.**
After issues with complex backup systems, this is a return to basics:
- Simple LVM snapshot creation
- Direct block-level copy with dd/pv
- Minimal logic, maximum reliability
## What This Does
1. **Creates an LVM snapshot** of your source volume
2. **Copies it block-for-block** to your target drive
3. **Cleans up the snapshot** when done
That's it. No complex migration logic, no fancy features that can break.
## Quick Start
### 1. See what's available
```bash
sudo ./list_drives.sh
```
### 2. Run a simple backup
```bash
sudo ./simple_backup.sh /dev/your-vg/your-lv /dev/your-target-drive
```
### 3. Or use the GUI
```bash
sudo python3 simple_backup_gui.py
```
## Examples
**Backup your root volume to an external SSD:**
```bash
sudo ./simple_backup.sh /dev/internal-vg/root /dev/sdb
```
**Backup your home volume:**
```bash
sudo ./simple_backup.sh /dev/internal-vg/home /dev/nvme1n1
```
## Important Notes
⚠️ **WARNING: The target drive will be completely overwritten!**
- Always run as root (`sudo`)
- Target device will lose ALL existing data
- Make sure target device is unmounted before backup
- The backup is a complete block-level clone
- You need at least 1GB free space in your volume group for the snapshot
## How It Works
This is exactly what happens, no hidden complexity:
1. `lvcreate -L1G -s -n backup_snap /dev/vg/lv` - Create snapshot
2. `pv /dev/vg/backup_snap | dd of=/dev/target bs=4M` - Copy data
3. `lvremove -f /dev/vg/backup_snap` - Remove snapshot
## Files
- `simple_backup.sh` - Command-line backup script
- `simple_backup_gui.py` - Simple GUI version
- `list_drives.sh` - Helper to show available drives
## Why This Approach?
The previous complex scripts had too much logic and caused system issues. This approach:
- ✅ Uses standard LVM commands
- ✅ Minimal chance of errors
- ✅ Easy to understand and debug
- ✅ Does exactly what you expect
- ✅ No hidden "smart" features
## Recovery
To boot from your backup:
1. Connect the external drive
2. Boot from it directly, or
3. Use it as a recovery drive to restore your system
## Requirements
- LVM-enabled system
- Root access
- Python 3 + tkinter (for GUI)
- `pv` command (optional, for progress display)
## If Something Goes Wrong
The script will try to clean up snapshots automatically. If it fails:
```bash
# List any remaining snapshots
sudo lvs | grep snap
# Remove manually if needed
sudo lvremove /dev/vg/snapshot_name
```
## No More Complex Features
This system intentionally does NOT include:
- Automatic drive detection with complex logic
- Migration between different LVM setups
- Boot repair or GRUB handling
- Multiple backup formats
- Configuration files
- Complex error handling
If you need those features, use dedicated tools like CloneZilla or Borg Backup.
This is for simple, reliable block-level LVM backups. Nothing more, nothing less.