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
  • 7
  • I always thought that the root partition is very small. A 2TB HDD root partition is laughable! :) – tlfong01 Jul 17 '19 at 04:04
  • If you want help tell us **what YOU did** - NOT link to a sequence of posts full of misinformation. Include the output of `sudo fdisk -l …` for your HDD. – Milliways Jul 17 '19 at 04:27
  • @tlfong01 - are you thinking of boot partition? what's so amusing about a 2TB root partition? – Jaromanda X Jul 17 '19 at 05:01
  • @Jaromanda, Ah, my apologies. I was indeed confused root partition with boot partition. Actually I am a Windows guy and know very little about linux partitions. For my Windows PC, I have a "C:" partition which I think corresponds to the linux "root" partition which I store the Windows systems and third party application programs. And there is the "D:" partition which I store the application programs I am writing for my Micky Mouse projects. – tlfong01 Jul 17 '19 at 05:12
  • it seems futile offering a bounty when you won't explain what you have done. – Milliways Jul 19 '19 at 12:53
  • I'm confused. I link to the forum thread which describes instructions for setting up the an `initramfs`, updating your commandline, and updating `/etc/fstab`. I also very clearly specify that I verified that these things were done correctly. What about my post doesn't tell you what I've done? – alexgolec Jul 19 '19 at 14:53
  • For clarity I've noted the relevant portions of the thread that I applied. – alexgolec Jul 19 '19 at 15:30
  • Why do you need an `initramfs`? Please address me with @Ingo, otherwise I won't see your reply. – Ingo Jul 19 '19 at 15:58
  • If you need an `initramfs` to boot, how do you boot to create the `initramfs`? Do you use a SD Card in addition? – Ingo Jul 19 '19 at 20:13

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
  • 40,606
  • 15
  • 76
  • 189
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
  • 7
  • Thanks :-) But you don't tell anywhere in your question that you boot from a SD Card and not from the HDD itself so I was a bit on the wrong path. It was only after I realized that booting from another device on RPi 4B isn't supported. – Ingo Jul 20 '19 at 17:39
  • That's actually very interesting, can you point me to a source for that? I actually prefer booting from another device and I'd love to learn why they got rid of that option. – alexgolec Jul 20 '19 at 17:39
  • "*USB host and Ethernet boot can be performed by BCM2837-based Raspberry Pis - that is, Pi 2B version 1.2, Pi 3B, and Pi 3B+ (Raspberry Pi 3A+ cannot net boot since it does not have a built-in Ethernet interface)*", source [Raspberry Pi boot modes](https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/). I have verified it in the context of your question. I have Raspbian Lite flashed to an USB stick. That booted without a SD Card on a RPi 3B+ but does not on RPi 4B. – Ingo Jul 20 '19 at 17:48