hexdump0815/imagebuilder

growing partition to full sd card size fails to boot

Simbaclaws opened this issue · 6 comments

Hi,

I'm trying to boot the kukui ubuntu jammy image on a chromebook ideapad 3, and it works perfectly fine if I leave the sd card unaltered.
But that only gives me 3gb of space, while my sdcard has 512gb of space....

I tried using gparted and parted to change the partition size of the btrfs partition, then mounting the partition with:
sudo mount /dev/mmcblk0p4 /mnt

And then using:
sudo btrfs filesystem resize max /mnt

And this seems to resize the btrfs filesystem completely.

However, when I now put the sd card in my chromebook, it simply beeps once when I try to press alt + ctrrl + U. And does not want to boot at all anymore.

Are there any special steps that need to be taken in order to grow the partition size of the btrfs root partition?

I'm doing this on another pc with linux installed.

just run /scripts/extend-rootfs.sh as root user when booted from the sd card - that should extend the root fs to the full size of the sd card. good luck

thank you I didn't know there was a script for that, that does it....

I have another question:

I tried installing onto the emmc, which worked, but then I wanted to expand the root partition with another disk using btrfs... Is this something that is doable somehow?

I have a sd card of 500gb that I would like to use to expand the root filesystem...

Currently I'm getting a:
end kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block

because I had used btrfs to expand the root filesystem partition with another disk /dev/sda

Any ideas on what I can do to expand my sd card storage onto the root partition?

I'm trying to move my root partition to my sd card, but I'm now figuring out that something inside the boot partition probably references /dev/mmcblk0p4, do you perhaps know what I need to alter to change this to /dev/sda1?

I already tried altering the /etc/fstab.

Currently I decided to just mount my /dev/sda1 sd card on my user's home directory with /etc/fstab and then use flatpaks to install apps in my home dir.

@Simbaclaws - sorry, i saw this github issue just now - not sure if this is possible with btrfs (might be) - the rootfs is hardcoded as the partition the kernel booted from+3 in the kernels on the image (https://github.com/hexdump0815/linux-mainline-mediatek-mt81xx-kernel/blob/master/misc.cbm/misc/cmdline) ... maybe give creating your own kernel kpart image, maybe even with initrd a try following the idea from

kukui example (others as comments - for some the device is mmcblk0 and for others mmcblk1):
#!/bin/bash
# adjust to kernel version and name here
kver="6.1.0-stb-mt8+"
cd /boot
cp -v vmlinux.kpart-initrd-${kver} vmlinux.kpart-initrd-${kver}.old
cp Image-${kver} Image
lzma -9 -z -f -k -v Image
cp initrd.img-${kver} initrd.img.xz
# for cbq add: deferred_probe_timeout=30 clk_ignore_unused=1
echo "console=tty1 root=LABEL=rootemmc rootwait ro fsck.fix=yes fsck.repair=yes net.ifnames=0 ipv6.disable=1 quiet splash" > cmdline
dd if=/dev/zero of=bootloader.bin bs=512 count=1
# adjust to dtb names here:
# - cbg: dtb-${kver}/rk3399-gru-*.dtb
# - mt7: dtb-${kver}/mt8173-*.dtb
# - mt8: dtb-${kver}/mt8183-*.dtb
# - cbq: dtb-${kver}/sc7180-trogdor-*.dtb
ls dtb-${kver}/mt8183-*.dtb | xargs printf " -b %s" | xargs mkimage -D "-I dts -O dtb -p 2048" -f auto -A arm64 -O linux -T kernel -C lzma -a 0 -d Image.lzma -i initrd.img.xz kernel.itb
vbutil_kernel --pack vmlinux.kpart --keyblock /usr/share/vboot/devkeys/kernel.keyblock --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --version 1 --config cmdline --bootloader bootloader.bin --vmlinuz kernel.itb --arch arm
cp -v vmlinux.kpart /boot/vmlinux.kpart-initrd-${kver}
rm -f Image Image.lzma initrd.img.xz cmdline bootloader.bin kernel.itb vmlinux.kpart
echo ""
echo "for single boot only testing:"
echo "IMPORTANT: please double check your mmcblk device name beforehand"
echo ""
echo " dd if=/boot/vmlinux.kpart-initrd-${kver} of=/dev/mmcblk0p2"
echo " cgpt add -i 2 -S 0 -T 1 -P 15 /dev/mmcblk0"
echo ""
echo "to always boot this kernel after successful testing:"
echo ""
echo " dd if=/boot/vmlinux.kpart-initrd-${kver} of=/dev/mmcblk0p1"
echo ""
as mentioned above: after creating this script and making it executable, run it once
... in the same dir are also some docs about building and installing own kernels which might be interesting to read

thank you for the clearvoyant response.

For now I'm happy with /dev/sda1 being mounted on my home dir.

it already gives a lot of space to work with.

If I find my root partition to be lacking space, I'll try to build my own kernel based on those instructions.

Thank you so much for taking the time to do all of this. It brought life to my cheap chromebook :)