Created
May 16, 2025 04:06
-
-
Save gofullthrottle/80aba93e49240e8c1dea19315eecbd3f to your computer and use it in GitHub Desktop.
Run from Ubuntu Live USB to check >2TB disk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# check_2tb_support.sh | |
# ASCII-formatted CLI diagnostic for >2TB disk support | |
# Run from Ubuntu Live USB — NO emoji, no color codes, remote-shell and log-safe | |
set -e | |
echo | |
echo "==================================================" | |
echo " 2TB+ DISK COMPATIBILITY CHECK (ASCII SAFE) " | |
echo "==================================================" | |
# Step 1: Detect Boot Mode | |
echo | |
echo "--------------------------------------------------" | |
echo " Step 1: Boot Mode Detection" | |
echo "--------------------------------------------------" | |
if [ -d /sys/firmware/efi ]; then | |
printf " %-18s : %s\n" "Boot Mode" "UEFI (Recommended)" | |
else | |
printf " %-18s : %s\n" "Boot Mode" "Legacy BIOS" | |
echo " [WARNING] Legacy BIOS may not support booting from disks >2TB" | |
echo " Consider switching to UEFI or adding a BIOS boot partition" | |
fi | |
# Step 2: List Disks | |
echo | |
echo "--------------------------------------------------" | |
echo " Step 2: Detected Disks (Device, Size, Model)" | |
echo "--------------------------------------------------" | |
lsblk -d -o NAME,SIZE,MODEL,TYPE | grep -E 'disk' || echo " [INFO] No disks detected" | |
# Step 3: Check Partition Tables | |
echo | |
echo "--------------------------------------------------" | |
echo " Step 3: Partition Table Types" | |
echo "--------------------------------------------------" | |
for dev in /dev/sd?; do | |
echo | |
echo " Device: $dev" | |
parted_out=$(sudo parted -s "$dev" print 2>/dev/null | grep -E 'Model|Disk|Partition Table') | |
if [[ -n "$parted_out" ]]; then | |
echo "$parted_out" | sed 's/^/ /' | |
else | |
echo " [INFO] No partition table or disk unreadable" | |
fi | |
done | |
# Step 4: Test GPT Creation | |
echo | |
echo "--------------------------------------------------" | |
echo " Step 4: Optional GPT Partition Table Test" | |
echo "--------------------------------------------------" | |
read -rp " Enter UNUSED disk (e.g. /dev/sdb) or press [Enter] to skip: " target | |
if [[ -n "$target" ]]; then | |
echo | |
echo " [WARNING] This operation will overwrite the partition table on $target" | |
read -rp " Type 'YES' to proceed: " confirm | |
if [[ "$confirm" == "YES" ]]; then | |
echo | |
echo " Creating GPT label on $target..." | |
sudo parted -s "$target" mklabel gpt | |
echo | |
echo " Free space after GPT label applied:" | |
sudo parted -s "$target" unit TB print free | |
else | |
echo " [INFO] GPT label creation skipped by user" | |
fi | |
else | |
echo " [INFO] Skipped GPT creation test" | |
fi | |
# Step 5: SATA / RAID Controllers | |
echo | |
echo "--------------------------------------------------" | |
echo " Step 5: SATA / RAID Controller Info" | |
echo "--------------------------------------------------" | |
lspci | grep -i -E 'sata|raid|storage' || echo " [INFO] No controller info found" | |
# Step 6: Kernel Messages | |
echo | |
echo "--------------------------------------------------" | |
echo " Step 6: Kernel Log for Disk Warnings" | |
echo "--------------------------------------------------" | |
dmesg | grep -i 'logical block' || echo " [INFO] No block size warnings in dmesg" | |
# Done | |
echo | |
echo "==================================================" | |
echo " CHECK COMPLETE " | |
echo "==================================================" | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment