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:
86
list_drives.sh
Executable file
86
list_drives.sh
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Enhanced script to list available backup sources and targets
|
||||
# Shows options for all three backup modes
|
||||
|
||||
echo "=== Enhanced Simple LVM Backup - Available Options ==="
|
||||
echo ""
|
||||
|
||||
echo "=== SOURCES ==="
|
||||
echo ""
|
||||
echo "Logical Volumes (for lv-to-lv and lv-to-raw modes):"
|
||||
echo "---------------------------------------------------"
|
||||
if command -v lvs >/dev/null 2>&1; then
|
||||
echo "Path Size VG Name"
|
||||
echo "----------------------------------------"
|
||||
lvs --noheadings -o lv_path,lv_size,vg_name | while read lv_path lv_size vg_name; do
|
||||
printf "%-24s %-8s %s\n" "$lv_path" "$lv_size" "$vg_name"
|
||||
done
|
||||
else
|
||||
echo "LVM not available"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Volume Groups (for vg-to-raw mode):"
|
||||
echo "-----------------------------------"
|
||||
if command -v vgs >/dev/null 2>&1; then
|
||||
echo "VG Name Size PV Count"
|
||||
echo "----------------------------------"
|
||||
vgs --noheadings -o vg_name,vg_size,pv_count | while read vg_name vg_size pv_count; do
|
||||
printf "%-16s %-8s %s PVs\n" "$vg_name" "$vg_size" "$pv_count"
|
||||
done
|
||||
else
|
||||
echo "LVM not available"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== TARGETS ==="
|
||||
echo ""
|
||||
echo "Existing Logical Volumes (for lv-to-lv mode):"
|
||||
echo "---------------------------------------------"
|
||||
if command -v lvs >/dev/null 2>&1; then
|
||||
echo "Path Size VG Name"
|
||||
echo "----------------------------------------"
|
||||
lvs --noheadings -o lv_path,lv_size,vg_name | while read lv_path lv_size vg_name; do
|
||||
# Highlight external/backup VGs
|
||||
if [[ "$vg_name" == *"migration"* ]] || [[ "$vg_name" == *"external"* ]] || [[ "$vg_name" == *"backup"* ]]; then
|
||||
printf "%-24s %-8s %s (backup VG)\n" "$lv_path" "$lv_size" "$vg_name"
|
||||
else
|
||||
printf "%-24s %-8s %s\n" "$lv_path" "$lv_size" "$vg_name"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "LVM not available"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Raw Block Devices (for lv-to-raw and vg-to-raw modes):"
|
||||
echo "------------------------------------------------------"
|
||||
echo "Device Size Model"
|
||||
echo "-------------------------"
|
||||
lsblk -dno NAME,SIZE,MODEL | grep -E '^sd|^nvme' | while read name size model; do
|
||||
printf "/dev/%-6s %-8s %s\n" "$name" "$size" "$model"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "=== USAGE EXAMPLES ==="
|
||||
echo ""
|
||||
echo "1. LV to LV (update existing backup):"
|
||||
echo " sudo ./enhanced_simple_backup.sh lv-to-lv /dev/internal-vg/root /dev/backup-vg/root"
|
||||
echo ""
|
||||
echo "2. LV to Raw Device (fresh backup):"
|
||||
echo " sudo ./enhanced_simple_backup.sh lv-to-raw /dev/internal-vg/root /dev/sdb"
|
||||
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 "=== GUI VERSION ==="
|
||||
echo " sudo python3 simple_backup_gui.py"
|
||||
echo ""
|
||||
echo "=== IMPORTANT NOTES ==="
|
||||
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 "- Make sure target devices are unmounted before backup"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user