RPi-Distro / pi-gen

Tool used to create the official Raspberry Pi OS images
BSD 3-Clause "New" or "Revised" License
2.58k stars 1.61k forks source link

resize2fs_once service no longer resizes root fs. #783

Closed theGOTOguy closed 1 month ago

theGOTOguy commented 1 month ago

I'm not sure when this got broken, but it did correctly work at 9249e146d2e3987adf2ea0e5e19e295d37f3f886 and does not work at dca93d24c7dfb943d84601d2bc4a089f9b66b87f.

Service actually runs, but doesn't detect that a resize needs to happen.

PXL_20240727_034407920

The file system didn't get resized:

PXL_20240727_034418705 MP

Running raspi-config --expand-rootfs does correctly resize the root file system, though.

XECDesign commented 1 month ago

It looks like the partition table isn't getting adjusted on first boot in your case.

Is your image skipping firstboot in some way?

theGOTOguy commented 1 month ago

I don't believe so: you can see from the screenshot that resize2fs_once actually ran. It just didn't do anything.

I did try manually running resize2fs from the CLI, and it said "nothing to do," even though it in fact had plenty to do.

Running raspi-config --expand-rootfs did correctly resize the root fs.

XECDesign commented 1 month ago

Note that firstboot is not resize2fs_once. I saw that resize2fs ran, but that's exactly how it would behave if firstboot didn't.

Think of the partition as a container and the filesystem as the content. firstboot edits the partition table to expand the partition table. Then resize2fs_once expands the filesystem to fill the partition. If the partition has not been expanded, there is nowhere for the filesystem to expand into. You can use sudo fdisk -l /dev/mmcblk0 to confirm this.

theGOTOguy commented 1 month ago

Oh, that's a good point. I will have to produce a new image to confirm.

theGOTOguy commented 1 month ago

Apologies, I produced a vanilla Raspbian Lite build from head and was unable to reproduce this issue.

It must be something specific to my custom build causing firstboot to fail.

Closing unable to reproduce.