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

@@ -74,11 +74,13 @@ echo ""
echo "3. Entire VG to Raw Device (complete clone):"
echo " sudo ./enhanced_simple_backup.sh vg-to-raw internal-vg /dev/sdb"
echo ""
echo "4. LV to Borg Repository (encrypted backup):"
echo "4. LV to Borg Repository (block-level backup):"
echo " sudo ./enhanced_simple_backup.sh lv-to-borg /dev/internal-vg/root /path/to/borg/repo --new-repo"
echo " → Stores raw snapshot as 'root.img' in Borg repo"
echo ""
echo "5. Entire VG to Borg Repository (all LVs):"
echo "5. Entire VG to Borg Repository (all LVs as block devices):"
echo " sudo ./enhanced_simple_backup.sh vg-to-borg internal-vg /path/to/borg/repo --encryption repokey"
echo " → Stores each LV as separate .img files (root.img, home.img, etc.)"
echo ""
echo "=== GUI VERSION ==="
echo " sudo python3 simple_backup_gui.py"
@@ -88,7 +90,9 @@ echo "- Always run as root (sudo)"
echo "- lv-to-lv: Updates existing backup LV"
echo "- lv-to-raw: Creates fresh backup, overwrites target device"
echo "- vg-to-raw: Clones entire VG including LVM metadata"
echo "- lv-to-borg/vg-to-borg: Creates deduplicated, compressed, encrypted backups"
echo "- lv-to-borg/vg-to-borg: Creates block-level backups in Borg (preserves exact LV state)"
echo "- LV→Borg stores snapshot as single .img file, VG→Borg stores each LV as separate .img"
echo "- Borg backups are deduplicated, compressed, and encrypted"
echo "- Borg backups require: sudo apt install borgbackup"
echo "- Make sure target devices are unmounted before backup"
echo ""