Problem: VG→Borg was creating temp files for all LVs simultaneously, causing 'no space left' errors when LVs are large. Solution: Process LVs sequentially instead of simultaneously: 1. Create snapshot for one LV 2. Stream it directly to Borg (no temp files) 3. Remove snapshot immediately 4. Move to next LV Changes: - VG→Borg now creates separate archives per LV instead of one big archive - Each LV gets its own archive: vg_internal-vg_lv_root_20241009_123456 - No temporary files needed - direct streaming - Space-efficient: only one snapshot exists at a time - More robust: failure of one LV doesn't affect others Benefits: - No more space issues regardless of LV sizes - Faster cleanup between LVs - Individual LV recovery possible - Better error isolation - Still preserves block-level backup benefits
135 lines
4.0 KiB
Markdown
135 lines
4.0 KiB
Markdown
# Enhanced Simple LVM Backup System with Borg Support
|
|
|
|
A reliable, straightforward backup system for LVM-enabled Linux systems. Born from the need for simple, dependable backups without complex logic that can cause system issues.
|
|
|
|
## Philosophy
|
|
|
|
**Simple is better.** This system does exactly three things:
|
|
1. Create LVM snapshot
|
|
2. Copy data (dd/pv for raw, Borg for repositories)
|
|
3. Clean up snapshot
|
|
|
|
No complex migration logic, no fancy features that can break. Just reliable backups.
|
|
|
|
## Features
|
|
|
|
### Five Backup Modes
|
|
|
|
- **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 **block device** to Borg repository (preserves exact block-level state)
|
|
- **VG → Borg**: Backup **all block devices** from volume group to Borg repository
|
|
|
|
### Two Interfaces
|
|
|
|
- **GUI**: `simple_backup_gui.py` - User-friendly interface with Borg configuration
|
|
- **CLI**: `enhanced_simple_backup.sh` - Command-line power user interface
|
|
|
|
## Quick Start
|
|
|
|
### 1. See Available Options
|
|
```bash
|
|
sudo ./list_drives.sh
|
|
```
|
|
|
|
### 2. Choose Your Backup Mode
|
|
|
|
**Update existing backup:**
|
|
```bash
|
|
sudo ./enhanced_simple_backup.sh lv-to-lv /dev/internal-vg/root /dev/backup-vg/root
|
|
```
|
|
|
|
**Fresh backup to external drive:**
|
|
```bash
|
|
sudo ./enhanced_simple_backup.sh lv-to-raw /dev/internal-vg/root /dev/sdb
|
|
```
|
|
|
|
**Clone entire system:**
|
|
```bash
|
|
sudo ./enhanced_simple_backup.sh vg-to-raw internal-vg /dev/sdb
|
|
```
|
|
|
|
**Use the GUI:**
|
|
```bash
|
|
sudo python3 simple_backup_gui.py
|
|
```
|
|
|
|
**Borg repository backups (block-level):**
|
|
```bash
|
|
# 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 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 one snapshot as `{lv_name}.img` in a single archive
|
|
- **VG → Borg**: Creates separate archives for each LV (space-efficient, processes one LV at a time)
|
|
|
|
## Files
|
|
|
|
### Core System
|
|
- `simple_backup_gui.py` - GUI interface with mode selection
|
|
- `enhanced_simple_backup.sh` - CLI with three backup modes
|
|
- `list_drives.sh` - Helper to show available sources/targets
|
|
- `SIMPLE_BACKUP_README.md` - Detailed documentation
|
|
|
|
### Legacy Files
|
|
- `old_scripts/` - Previous complex implementations (archived)
|
|
- Various `.md` files - Documentation from previous iterations
|
|
|
|
## Requirements
|
|
|
|
- LVM-enabled Linux system
|
|
- Root access (`sudo`)
|
|
- Python 3 + tkinter (for GUI)
|
|
- `pv` command (optional, for progress display)
|
|
- **Borg Backup** (for Borg modes): `sudo apt install borgbackup`
|
|
|
|
## Safety Features
|
|
|
|
- Clear confirmations before destructive operations
|
|
- Automatic snapshot cleanup on errors
|
|
- Emergency stop functionality (GUI)
|
|
- Input validation and error handling
|
|
|
|
## What This System Does NOT Do
|
|
|
|
- Complex migration between different LVM setups
|
|
- Automatic boot repair or GRUB handling
|
|
- Multiple backup formats or compression
|
|
- Network backups or cloud integration
|
|
- File-level incremental backups
|
|
|
|
For those features, use dedicated tools like Borg Backup, CloneZilla, or rsync.
|
|
|
|
## Why This Approach?
|
|
|
|
Previous versions of this project included complex migration logic that occasionally caused system issues. This version returns to basics:
|
|
|
|
✅ Uses standard LVM commands only
|
|
✅ Minimal chance of errors
|
|
✅ Easy to understand and debug
|
|
✅ Predictable behavior
|
|
✅ No hidden "smart" features
|
|
|
|
## Recovery
|
|
|
|
### From LV Backup
|
|
Mount the backup LV and copy files, or use it to restore your system.
|
|
|
|
### From Raw Device Backup
|
|
Boot directly from the device, or restore using dd in reverse.
|
|
|
|
### From VG Clone
|
|
Import the volume group or boot directly from the cloned device.
|
|
|
|
## Contributing
|
|
|
|
Keep it simple. Any additions should follow the core principle: minimal logic, maximum reliability.
|
|
|
|
## License
|
|
|
|
Open source - use and modify as needed. |