#!/bin/bash # Final Internal Drive Configuration Check # Run this after rebooting to verify everything is working echo "═══════════════════════════════════════════════════════" echo " Internal NVMe Drive Configuration Verification" echo "═══════════════════════════════════════════════════════" echo "" # Color codes GREEN='\033[0;32m' RED='\033[0;31m' YELLOW='\033[1;33m' NC='\033[0m' # No Color success_count=0 total_checks=7 echo "Running system checks..." echo "" # Check 1: Root filesystem echo -n "1. Root filesystem from internal drive... " if mount | grep -q "internal--vg-root on / "; then echo -e "${GREEN}✓ PASS${NC}" ((success_count++)) else echo -e "${RED}✗ FAIL${NC}" mount | grep " / " fi # Check 2: Boot filesystem echo -n "2. Boot filesystem from internal drive... " if mount | grep -q "internal--vg-boot on /boot "; then echo -e "${GREEN}✓ PASS${NC}" ((success_count++)) else echo -e "${RED}✗ FAIL${NC}" mount | grep " /boot " fi # Check 3: Home filesystem echo -n "3. Home filesystem from internal drive... " HOME_DEVICE=$(sudo cryptsetup status luks-home-internal 2>/dev/null | grep "device:" | awk '{print $2}') if [[ "$HOME_DEVICE" == "/dev/mapper/internal--vg-home" ]]; then echo -e "${GREEN}✓ PASS${NC}" ((success_count++)) else echo -e "${RED}✗ FAIL${NC}" echo " Currently using: $HOME_DEVICE" fi # Check 4: EFI partition echo -n "4. EFI partition from internal drive... " if mount | grep -q "nvme0n1p1 on /boot/efi"; then echo -e "${GREEN}✓ PASS${NC}" ((success_count++)) else echo -e "${RED}✗ FAIL${NC}" mount | grep "/boot/efi" fi # Check 5: GRUB installation echo -n "5. GRUB bootloader installed... " if [ -f /boot/efi/EFI/ubuntu/shimx64.efi ] && [ -f /boot/efi/EFI/ubuntu/grubx64.efi ]; then echo -e "${GREEN}✓ PASS${NC}" ((success_count++)) else echo -e "${RED}✗ FAIL${NC}" fi # Check 6: EFI boot order echo -n "6. Ubuntu first in boot order... " FIRST_BOOT=$(efibootmgr | grep BootOrder | cut -d':' -f2 | tr -d ' ' | cut -d',' -f1) if [ "$FIRST_BOOT" = "0001" ] && efibootmgr | grep -q "Boot0001.*Ubuntu"; then echo -e "${GREEN}✓ PASS${NC}" ((success_count++)) else echo -e "${RED}✗ FAIL${NC}" echo " First boot entry: $FIRST_BOOT" fi # Check 7: External drive status echo -n "7. External drive NOT in use for system... " if ! mount | grep -q "migration--vg.*on /"; then echo -e "${GREEN}✓ PASS${NC}" ((success_count++)) else echo -e "${YELLOW}⚠ WARNING${NC}" echo " External drive (migration-vg) is mounted for system use" mount | grep migration-vg fi echo "" echo "═══════════════════════════════════════════════════════" echo " Results: $success_count/$total_checks checks passed" echo "═══════════════════════════════════════════════════════" echo "" if [ $success_count -eq $total_checks ]; then echo -e "${GREEN}✓ SUCCESS!${NC} Internal drive is fully configured and operational." echo "" echo "Your system is now running entirely from the internal NVMe drive." echo "The external M.2 drive can be used as a backup." echo "" echo "Next steps:" echo " 1. Test disconnecting the external drive and rebooting" echo " 2. Run backup: sudo ./lvm_block_backup.sh" echo "" elif [ $success_count -ge 5 ]; then echo -e "${YELLOW}⚠ PARTIAL SUCCESS${NC} - Most checks passed but some issues remain." echo "" echo "Review the failed checks above and consult INTERNAL_DRIVE_RECOVERY.md" echo "" else echo -e "${RED}✗ CONFIGURATION ISSUES DETECTED${NC}" echo "" echo "Several checks failed. You may need to reboot for changes to take effect." echo "If problems persist after reboot, review INTERNAL_DRIVE_RECOVERY.md" echo "" fi # Additional info echo "═══════════════════════════════════════════════════════" echo " Detailed Information" echo "═══════════════════════════════════════════════════════" echo "" echo "Current mount points:" lsblk -o NAME,SIZE,TYPE,MOUNTPOINT | grep -E "NAME|nvme0n1|sda" echo "" echo "LUKS device mapping:" sudo cryptsetup status luks-home-internal 2>/dev/null | grep -E "type|device|mode" echo "" echo "EFI boot configuration:" efibootmgr | grep -E "BootCurrent|BootOrder|Boot0001" echo "" if [ -b /dev/sda ]; then echo -e "${YELLOW}Note:${NC} External drive (sda) is connected." echo " To test full independence, shutdown and disconnect it." else echo -e "${GREEN}Note:${NC} External drive is not connected - full independence confirmed!" fi echo ""