mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-28 16:58:03 +01:00
add GPT integrity check for amd64 (#4576)
This commit is contained in:
parent
e63326bbea
commit
bf9dbc0321
1 changed files with 28 additions and 0 deletions
|
@ -337,6 +337,34 @@ else
|
|||
echo "No HDMI switch found. " >> $logFile
|
||||
fi
|
||||
|
||||
################################
|
||||
# GPT integrity check
|
||||
################################
|
||||
|
||||
check_and_fix_gpt() {
|
||||
local device=$1
|
||||
output=$(sudo gdisk -l $device 2>&1)
|
||||
if echo "$output" | grep -q "PMBR size mismatch"; then
|
||||
echo "GPT PMBR size mismatch detected on $device. Fixing..." >> $logFile
|
||||
sgdisk -e $device
|
||||
echo "Fixed GPT PMBR size mismatch on $device." >> $logFile
|
||||
elif echo "$output" | grep -q "The backup GPT table is not on the end of the device"; then
|
||||
echo "Backup GPT table is not at the end of $device. Fixing..." >> $logFile
|
||||
sgdisk -e $device
|
||||
echo "Fixed backup GPT table location on $device." >> $logFile
|
||||
else
|
||||
echo "No GPT issues detected on $device." >> $logFile
|
||||
fi
|
||||
}
|
||||
|
||||
# List all block devices
|
||||
devices=$(lsblk -dno NAME | grep -E '^sd|^nvme|^vd|^mmcblk')
|
||||
|
||||
# Check and fix each device
|
||||
for dev in $devices; do
|
||||
check_and_fix_gpt /dev/$dev
|
||||
done
|
||||
|
||||
################################
|
||||
# FS EXPAND
|
||||
# extend sd card to maximum capacity
|
||||
|
|
Loading…
Add table
Reference in a new issue