fix: Implement proper block-level Borg backups

BREAKING CHANGE: Borg backups now store raw block devices instead of files

Changes:
- LV→Borg: Stores snapshot as raw block device (.img file) in Borg
- VG→Borg: Stores each LV as separate .img files in Borg repository
- No more file-level mounting - preserves exact block-level state
- Uses dd | borg create --stdin-name for LV backups
- Creates temporary .img files for VG backups
- Maintains all filesystem metadata, boot sectors, etc.
- Better deduplication for similar block patterns

Benefits:
- Exact block-level restoration possible
- Preserves all filesystem metadata
- Better suited for system/boot volume backups
- Still gets Borg's compression, deduplication, encryption
- Clear difference between LV and VG modes

Now LV→Borg and VG→Borg have distinct, useful purposes:
- LV→Borg: Single logical volume as one block device
- VG→Borg: All logical volumes as separate block devices
This commit is contained in:
root
2025-10-09 00:45:22 +02:00
parent 179a84e442
commit aee3d5019c
4 changed files with 113 additions and 137 deletions

View File

@@ -18,8 +18,8 @@ No complex migration logic, no fancy features that can break. Just reliable back
- **LV → LV**: Update existing logical volume backups
- **LV → Raw**: Create fresh backups on raw devices
- **VG → Raw**: Clone entire volume groups with LVM metadata
- **LV → Borg**: Backup logical volume to Borg repository (deduplicated, compressed, encrypted)
- **VG → Borg**: Backup entire volume group to Borg repository
- **LV → Borg**: Backup logical volume **block device** to Borg repository (preserves exact block-level state)
- **VG → Borg**: Backup **all block devices** from volume group to Borg repository
### Two Interfaces
@@ -55,15 +55,19 @@ sudo ./enhanced_simple_backup.sh vg-to-raw internal-vg /dev/sdb
sudo python3 simple_backup_gui.py
```
**Borg repository backups:**
**Borg repository backups (block-level):**
```bash
# Create new Borg repo and backup LV
# Create new Borg repo and backup LV as block device
sudo ./enhanced_simple_backup.sh lv-to-borg /dev/internal-vg/root /path/to/borg/repo --new-repo --encryption repokey --passphrase mypass
# Backup entire VG to existing repo
# Backup entire VG as multiple block devices to existing repo
sudo ./enhanced_simple_backup.sh vg-to-borg internal-vg /path/to/borg/repo --passphrase mypass
```
**Key Difference:**
- **LV → Borg**: Stores the raw snapshot as `{lv_name}.img` in Borg
- **VG → Borg**: Stores all LVs as separate `.img` files (`root.img`, `home.img`, etc.)
## Files
### Core System