Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4042

Troubleshooting • Re: Pi5 RPiOS Bookworm GPT PMBR size mismatch

$
0
0
The 1st boot resizer script apparently simply claims everything till the last sector. It is quite amazing that for a RPiOS Bookworm om a Pi5 no GPT compliance is taken into account. GPT uses a backup partition table at the end of the blockdevice, so needs at least 33 sectors for that. If you create a partitions from scratch with gdisk, some extra space is kept at the end (assume alignment rules applied); You get the following:

Code:

root@raspi3:/tmp# gdisk dummyNVMEGPT fdisk (gdisk) version 1.0.9Partition table scan:  MBR: not present  BSD: not present  APM: not present  GPT: not presentCreating new GPT entries in memory.Command (? for help): nPartition number (1-128, default 1): First sector (34-4000797326, default = 2048) or {+-}size{KMGTP}: 8192Last sector (8192-4000797326, default = 4000796671) or {+-}size{KMGTP}: +512MCurrent type is 8300 (Linux filesystem)Hex code or GUID (L to show codes, Enter = 8300): 0700Changed type of partition to 'Microsoft basic data'Command (? for help): pDisk dummyNVME: 4000797360 sectors, 1.9 TiBSector size (logical): 512 bytesDisk identifier (GUID): AF24D1B7-0BCB-4DAD-A35C-F8C4AA274E59Partition table holds up to 128 entriesMain partition table begins at sector 2 and ends at sector 33First usable sector is 34, last usable sector is 4000797326Partitions will be aligned on 2048-sector boundariesTotal free space is 3999748717 sectors (1.9 TiB)Number  Start (sector)    End (sector)  Size       Code  Name   1            8192         1056767   512.0 MiB   0700  Microsoft basic dataCommand (? for help): nPartition number (2-128, default 2): First sector (34-4000797326, default = 1056768) or {+-}size{KMGTP}: Last sector (1056768-4000797326, default = 4000796671) or {+-}size{KMGTP}: Current type is 8300 (Linux filesystem)Hex code or GUID (L to show codes, Enter = 8300): Changed type of partition to 'Linux filesystem'Command (? for help): pDisk dummyNVME: 4000797360 sectors, 1.9 TiBSector size (logical): 512 bytesDisk identifier (GUID): AF24D1B7-0BCB-4DAD-A35C-F8C4AA274E59Partition table holds up to 128 entriesMain partition table begins at sector 2 and ends at sector 33First usable sector is 34, last usable sector is 4000797326Partitions will be aligned on 2048-sector boundariesTotal free space is 8813 sectors (4.3 MiB)Number  Start (sector)    End (sector)  Size       Code  Name   1            8192         1056767   512.0 MiB   0700  Microsoft basic data   2         1056768      4000796671   1.9 TiB     8300  Linux filesystemCommand (? for help): wFinal checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTINGPARTITIONS!!Do you want to proceed? (Y/N): yOK; writing new GUID partition table (GPT) to dummyNVME.Warning: The kernel is still using the old partition table.The new table will be used at the next reboot or after yourun partprobe(8) or kpartx(8)The operation has completed successfully.root@raspi3:/tmp# gdisk -l dummyNVME GPT fdisk (gdisk) version 1.0.9Partition table scan:  MBR: protective  BSD: not present  APM: not present  GPT: presentFound valid GPT with protective MBR; using GPT.Disk dummyNVME: 4000797360 sectors, 1.9 TiBSector size (logical): 512 bytesDisk identifier (GUID): AF24D1B7-0BCB-4DAD-A35C-F8C4AA274E59Partition table holds up to 128 entriesMain partition table begins at sector 2 and ends at sector 33First usable sector is 34, last usable sector is 4000797326Partitions will be aligned on 2048-sector boundariesTotal free space is 8813 sectors (4.3 MiB)Number  Start (sector)    End (sector)  Size       Code  Name   1            8192         1056767   512.0 MiB   0700  Microsoft basic data   2         1056768      4000796671   1.9 TiB     8300  Linux filesystem
It is easy to fix if you boot the Pi5 from another installation running from USB or so. On a PC you would boot from a 'live-Linux-CD'. If you want to fix it manually, you need to shrink the filesystem on prttion 2 by at least 33 sectors and same for partition itself. So resize2f and gdisk can do the trick in principle. I say in principle as you might use PARTUUID to mount rootfs, you will also make sure that that UUID is the same.
There are other methods, 1 of them is that if your rootfs is Btrfs formatted, you can do it in the running system, no reboot needed. Maybe parted can do it all in 1 step, I never use that.

Statistics: Posted by redvli — Mon Mar 17, 2025 3:08 pm



Viewing all articles
Browse latest Browse all 4042

Trending Articles