- 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)
114 lines
3.2 KiB
Bash
Executable File
114 lines
3.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Mount backup tools partition and provide easy access
|
|
# Use this when booted from the external M.2 SSD
|
|
|
|
set -e
|
|
|
|
# Colors
|
|
GREEN='\033[0;32m'
|
|
BLUE='\033[0;34m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m'
|
|
|
|
print_info() {
|
|
echo -e "${BLUE}[INFO]${NC} $1"
|
|
}
|
|
|
|
print_success() {
|
|
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
|
}
|
|
|
|
print_warning() {
|
|
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
}
|
|
|
|
echo ""
|
|
echo "=========================================="
|
|
echo " Backup Tools Access Helper"
|
|
echo "=========================================="
|
|
echo ""
|
|
|
|
# Try to find backup tools partition
|
|
TOOLS_PARTITION=$(blkid -L "BACKUP_TOOLS" 2>/dev/null || echo "")
|
|
|
|
if [[ -z "$TOOLS_PARTITION" ]]; then
|
|
print_warning "Backup tools partition not found by label."
|
|
print_info "Searching for tools partition..."
|
|
|
|
# Look for small partitions that might be our tools partition
|
|
while IFS= read -r line; do
|
|
partition=$(echo "$line" | awk '{print $1}')
|
|
size=$(echo "$line" | awk '{print $4}')
|
|
|
|
# Check if it's a small partition (likely tools)
|
|
if [[ "$size" == *M ]] && [[ ${size%M} -le 1024 ]]; then
|
|
print_info "Found potential tools partition: $partition ($size)"
|
|
TOOLS_PARTITION="/dev/$partition"
|
|
break
|
|
fi
|
|
done < <(lsblk -n -o NAME,SIZE | grep -E "sd|nvme.*p")
|
|
fi
|
|
|
|
if [[ -z "$TOOLS_PARTITION" ]]; then
|
|
echo "❌ Could not find backup tools partition"
|
|
echo ""
|
|
echo "Available partitions:"
|
|
lsblk
|
|
echo ""
|
|
echo "To manually mount tools:"
|
|
echo "1. Identify the tools partition from the list above"
|
|
echo "2. sudo mkdir -p /mnt/backup_tools"
|
|
echo "3. sudo mount /dev/[partition] /mnt/backup_tools"
|
|
echo "4. cd /mnt/backup_tools/backup_system"
|
|
echo "5. ./launch_backup_tools.sh"
|
|
exit 1
|
|
fi
|
|
|
|
# Create mount point
|
|
MOUNT_POINT="/mnt/backup_tools"
|
|
print_info "Creating mount point: $MOUNT_POINT"
|
|
sudo mkdir -p "$MOUNT_POINT"
|
|
|
|
# Mount tools partition
|
|
print_info "Mounting tools partition: $TOOLS_PARTITION"
|
|
if sudo mount "$TOOLS_PARTITION" "$MOUNT_POINT"; then
|
|
print_success "Tools partition mounted successfully"
|
|
else
|
|
echo "❌ Failed to mount tools partition"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if backup system exists
|
|
if [[ -d "$MOUNT_POINT/backup_system" ]]; then
|
|
print_success "Backup tools found!"
|
|
|
|
cd "$MOUNT_POINT/backup_system"
|
|
|
|
echo ""
|
|
echo "📁 Backup tools are now available at:"
|
|
echo " $MOUNT_POINT/backup_system"
|
|
echo ""
|
|
echo "🚀 Available commands:"
|
|
echo " ./launch_backup_tools.sh - Interactive menu"
|
|
echo " ./backup_script.sh --help - Command line help"
|
|
echo " python3 backup_manager.py - GUI (if available)"
|
|
echo " ./create_desktop_entry.sh - Create desktop shortcut"
|
|
echo ""
|
|
|
|
# Ask what to do
|
|
read -p "Launch backup tools now? (y/n): " launch
|
|
if [[ "$launch" =~ ^[Yy] ]]; then
|
|
./launch_backup_tools.sh
|
|
else
|
|
echo ""
|
|
echo "Tools are ready to use. Change to the tools directory:"
|
|
echo "cd $MOUNT_POINT/backup_system"
|
|
fi
|
|
|
|
else
|
|
print_warning "Backup system not found in tools partition"
|
|
echo ""
|
|
echo "Contents of tools partition:"
|
|
ls -la "$MOUNT_POINT"
|
|
fi
|