1

I'm attempting to configure my raspberry pi 4 to boot from an external disk, and it works pretty well! I've configured it to boot from the partition ID I get from sudo blkid corresponding to my boot partition, and everything is dandy when I plug it in directly after flashing it with the image. I'm followed the instructions in this thread to great success:

https://www.raspberrypi.org/forums/viewtopic.php?t=105868

For clarity, I've done the following things recommended by this thread:

  • Created an initramfs and placed it on /boot
  • Updated my /boot/cmdline.txt to specify root=PARTUUID=xyz for the partition UUID
  • Updated `/etc/fstab' to specify the partition ID should be mounted as root.

However, things go off the rails when I attempt to resize the partition from its regular ~4gb size to its full 2TB glory. I boot into the SD card's root filesystem, open up gparted, and resize the root partition to extend to the full disk. Then I go to boot and I'm greeted with a message indicating mounting and resizing the root partition failed and my system is in emergency mode.

What gives? Is there a maximum size to the root partition?

UPDATE:

I've incorporated Ingo's suggestions: verified that the PARTUUID I specified in my /etc/fstab and my commandline flags is correct after the resize, as well as tested using /dev/sda2 as a target rather than the PARTUUID. This didn't resolve the issue.

Instead, I've disable quiet booting and observed a few things. First off, when I first boot into the freshly resized disk, I see the following:

What I think is happening here is that the fsck is timing out, and when I allow this to run its course I reboot and get something different. I get as far as this screen:

enter image description here

After which it flashes something that looks like a splash screen for a moment and then hangs. When I <Ctrl><Alt>-FX by way through the consoles, I find that 1 and 7 are black, and 2 through 6 show blinking cursors.

UPDATE 2:

This does not seem to be related to the size of the partition. I resized the partition from the old size to 1MB larger than the previous size, and it still had the same issue.

alexgolec
  • 77
  • 8

2 Answers2

2

When you resize a partition using a partition manager like gparted it may be possible that it silently changes the PARTUUID of the disk. But this is used by Raspbian to address the boot- and root-partition in /boot/cmdline.txt and in /etc/fstab. You should check if the entries in these files still match the actual settings of your disk.

Because of this issue I use the more generic partition names /dev/mmcblk0p1 and /dev/mmcblk0p2. For additional info about this problem you can look at Is it possible to use partition UUID for root-parameter in cmdline.txt?.

Ingo
  • 42,961
  • 20
  • 87
  • 207
0

The answer was simultaneously subtle and obvious: Because I was booted into the SD card's operating system at the time, I was editing the the /etc/fstab on the SD card and not on the hard drive. This explains all the phenomena I was seeing:

The system fscking the filesystem and then failing to boot? The /etc/fstab on the hard drive was still mapped to the old partition ID, so the pre-remount filesystem check worked but then mounting the root filesystem failed.

The system failing to boot on subsequent startups? Same issue as above, except it happened so quickly my display didn't show it.

The reason why this wasn't tied to the size of the partition? The resize changed the partition layout and thus changed the PARTUUID as Ingo suggested.

You can avoid this issue by making sure you're editing the HDD's /etc/fstab, which will typically be located at /media/pi/rootfs/etc/fstab.

ALSO

A bonus tip for future readers: if you use this "boot from SD root from HDD" technique, make sure when you update your /etc/fstab to reference the SD card's boot partition, because the default /etc/fstab and you flashed on from the Raspbian image points to the partition on the HDD, which you will in fact not be using. This will potentially save you hours of trying to figure out why your changes to /boot/cmdline.txt or /boot/config.txt aren't reflected.

Note I'm accepting this answer for the benefit of future readers, but awarding the bounty to Ingo for his help and insight.

alexgolec
  • 77
  • 8