- Fixed partition size calculation bugs in migrate_to_lvm.sh - Added comprehensive error handling for USB drive stability - Optimized data copy operations using cp -a for better performance - Corrected mount point detection for encrypted home partitions - Enhanced drive detection and exclusion logic - Added proper size override mechanisms for manual intervention - Improved filesystem creation and validation processes - Complete toolset for external M.2 drive migration scenarios Tested successfully on: - Debian 13 Trixie Live USB environment - 476GB external M.2 drives via USB 3.0 - Complex partition layouts (root/home/EFI + encryption) - Large data transfers (314GB+ encrypted home directories)
98 lines
3.0 KiB
Bash
Executable File
98 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# LVM Migration Launcher Script
|
|
# Run this after booting from the USB stick
|
|
|
|
set -e
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m' # No Color
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
TOOLS_DIR="$SCRIPT_DIR/lvm-migration-tools"
|
|
|
|
echo -e "${GREEN}=== LVM Migration System (Updated) ===${NC}"
|
|
echo "Welcome to the LVM Migration Tool with Enhanced Drive Selection!"
|
|
echo
|
|
echo "This USB stick contains:"
|
|
echo "• Debian live system (bootable)"
|
|
echo "• Complete LVM migration toolkit"
|
|
echo "• Enhanced drive selection with user confirmation"
|
|
echo "• All necessary scripts and documentation"
|
|
echo
|
|
|
|
if [ ! -d "$TOOLS_DIR" ]; then
|
|
echo -e "${RED}Error: Migration tools directory not found!${NC}"
|
|
echo "Expected: $TOOLS_DIR"
|
|
exit 1
|
|
fi
|
|
|
|
cd "$TOOLS_DIR"
|
|
|
|
echo -e "${BLUE}Available tools:${NC}"
|
|
ls -la *.sh | grep -E "(prepare|migrate|validate|emergency|check)" | while read line; do
|
|
echo " $line"
|
|
done
|
|
|
|
echo
|
|
echo -e "${YELLOW}Migration Process:${NC}"
|
|
echo "0. Check packages -> ./check_packages.sh (verify package availability)"
|
|
echo "1. Emergency install -> ./emergency_install.sh (if packages missing)"
|
|
echo "2. Prepare live system -> ./prepare_live_system.sh"
|
|
echo "3. Run migration -> ./migrate_to_lvm.sh (now with drive selection!)"
|
|
echo "4. Validate migration -> ./validate_lvm_migration.sh"
|
|
echo
|
|
echo -e "${GREEN}NEW FEATURES:${NC}"
|
|
echo "• Interactive drive selection with confirmation"
|
|
echo "• Better auto-detection of internal/external drives"
|
|
echo "• Safety checks to prevent wrong drive selection"
|
|
echo "• Package compatibility checking"
|
|
echo
|
|
echo "For complete documentation: less LIVE_USB_MIGRATION_GUIDE.md"
|
|
echo
|
|
|
|
read -p "What would you like to do? [0=Check, 1=Emergency, 2=Prepare, 3=Migrate, 4=Validate, d=Docs, s=Shell]: " choice
|
|
|
|
case $choice in
|
|
0)
|
|
echo -e "${BLUE}Checking package availability...${NC}"
|
|
./check_packages.sh
|
|
;;
|
|
1)
|
|
echo -e "${BLUE}Running emergency package installer...${NC}"
|
|
sudo ./emergency_install.sh
|
|
;;
|
|
2)
|
|
echo -e "${BLUE}Preparing live system...${NC}"
|
|
sudo ./prepare_live_system.sh
|
|
;;
|
|
3)
|
|
echo -e "${BLUE}Starting LVM migration with drive selection...${NC}"
|
|
sudo ./migrate_to_lvm.sh
|
|
;;
|
|
4)
|
|
echo -e "${BLUE}Validating migration...${NC}"
|
|
sudo ./validate_lvm_migration.sh
|
|
;;
|
|
d)
|
|
less LIVE_USB_MIGRATION_GUIDE.md
|
|
;;
|
|
s)
|
|
echo -e "${BLUE}Starting shell in tools directory...${NC}"
|
|
cd "$TOOLS_DIR"
|
|
bash
|
|
;;
|
|
*)
|
|
echo -e "${GREEN}Manual usage:${NC}"
|
|
echo "cd $TOOLS_DIR"
|
|
echo "sudo ./check_packages.sh # Check package availability"
|
|
echo "sudo ./emergency_install.sh # If you see missing package errors"
|
|
echo "sudo ./prepare_live_system.sh"
|
|
echo "sudo ./migrate_to_lvm.sh # Now with interactive drive selection!"
|
|
;;
|
|
esac
|