libretro / Lakka-LibreELEC

Lakka is a lightweight Linux distribution that transforms a small computer into a full blown game console.
https://www.lakka.tv
1.73k stars 286 forks source link

[RPi 5] Partition size issue on a 2TB NVMe #1963

Closed arusabu closed 5 months ago

arusabu commented 5 months ago

I'm using a Raspberry Pi 5, a PineberryPi HatDrive! Bottom and a 2TB NVMe, which is my main and only one drive (I want to have os and rom on the same disk).

On the first boot, Lakka doesn't resize correctly partitions : 0ynmqlvwwjgc1 (screen taken under an older version of Lakka but the exact same problem occurs with the current version of Lakka, "Lakka (official): 5.0 (RPi5.aarch64)")

The "LAKKA_DISK" partition can't be expanded to 1.82Tio with gparted by using resize2fs in Gparted ("New size results in too many block group descriptors.").

For this 2nd partition, do you use ex4 with 1KiB block size ? If so, that's the/my issue.

As a workaround, once the NVMe is flashed and before using it, I use gparted to resize the 2nd partition to 2Gio and to create a 3rd one in ExFAT by using the remaining space. image

ToKe79 commented 5 months ago

the partition at creation time is 32 MiB, so mke2fs determines automatically small block size, most probably 1 KiB. i think we can go with 4 KiB blocks, so we can add -b 4096 to mke2fs.

arusabu commented 5 months ago

Unless I'm doing something wrong, this issue is still presents on the devel-20240415170722-afaeeac (RPi5.aarch64)

After the 1st boot, I'm getting a new error : IMG_20240415_234230 IMG_20240415_234427

And once everything is done and I can boot on Lakka : Capture d'écran 2024-04-17 130048 Storage size appears to be 26 MB.

And here's what I've on GPARTED : 20240417_13h07m37s_grim Used : 31.36Mio Unused : 652.00Kio Unallocated : 1.82Tio Size : 1.82Tio

ToKe79 commented 5 months ago

Unfortunately I don't have a spare 2TB NVMe drive to debug the issue. You have to use manual partition setup.

arusabu commented 5 months ago

That's understandable.

That said, strangely enough, checking LAKKA_DISK in gparted solved the problem: it automatically added all the unallocated space to the partition.

Thanks you for your help and the fix.

ToKe79 commented 5 months ago

@arusabu this image should fix the issue: https://nightly.builds.lakka.tv/members/lakkabuildbot/fix_resize/RPi5.aarch64/

arusabu commented 5 months ago

@ToKe79 I confirm it does fix this issue.

There is no file system corruption and resizing is correctly performed on initial boot. Capture d'écran 2024-04-18 212706

Thank you very much for your support.

TechnologyClassroom commented 3 months ago

I was going to report this issue and workaround, but it looks like it is fixed. I am seeing this issue on regular 128GB MicroSD cards with the RPi5 Lakka 5.0 img.

This fix alone should probably be reason for a 5.1 release as most people do not know their way around gparted.

Edit: Adding more information.

After the recovery and everything the storage partition was only 26M.

/dev/mmcblk0p2           26.0M      2.2M     23.1M   9% /storage

These two commands from Ubuntu fixed it for me without gparted:

sudo e2fsck -f /dev/sdb2
e2fsck 1.46.5 (30-Dec-2021)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information

LAKKA_DISK: ***** FILE SYSTEM WAS MODIFIED *****
LAKKA_DISK: 197/8192 files (0.5% non-contiguous), 2105/8192 blocks

sudo resize2fs /dev/sdb2
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on /dev/sdb2 to 30009344 (4k) blocks.
The filesystem on /dev/sdb2 is now 30009344 (4k) blocks long.

Then it shows the full 113G:

/dev/sdb2               113G  2.2M  113G   1% /mnt