1

I have an external hard drive that I want to set as the filesystem root but boot from an SD card. How would I do this?

I've copied the filesystem to the partition, and tried updating config.txt with root=UUID={UUID} and cmdline.txt with root=UUID={UUID}. However, it still fails to start up and never completes the boot process, usually ending with kernel panic.

What am I missing?

cmdline.txt:

dwc_otg.lpm_enable=0 console=tty1 root=UUID=96fd5e33-3220-37e9-af31-b87ea8d03dda rootfstype=hfsplus elevator=deadline rootwait rootdelay=5

config.txt (different than default)

root=UUID=96fd5e33-3220-37e9-af31-b87ea8d03dda
initramfs initrd.sda

lsusb output:

Bus 002 Device 002: ID 1058:259c Western Digital Technologies, Inc. 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 04d9:0006 Holtek Semiconductor, Inc. 
Bus 001 Device 003: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

lsusb -t output:

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 2: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 3: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
            |__ Port 1: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
            |__ Port 1: Dev 4, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
8
  • I am using a 4B. not sure about the os
    – 2pichar
    Commented Dec 9, 2021 at 21:28
  • @bravo I used blkid to determine the uuid and partuuid, and did try partuuid={partuuid}
    – 2pichar
    Commented Dec 9, 2021 at 21:29
  • yes. If I was doing this from scratch, what steps do I take?
    – 2pichar
    Commented Dec 9, 2021 at 21:36
  • Let us continue this discussion in chat.
    – 2pichar
    Commented Dec 9, 2021 at 21:40
  • Well I've been able to mount the drive before. Could it still be a problem?
    – 2pichar
    Commented Dec 9, 2021 at 21:44

1 Answer 1

0

I solved my problem by doing a couple of things. First of all, my drive had been formatted as an HFS+ drive, so I suspect that that played a factor in preventing the RPi from booting correctly, and secondly I was using the UUID instead of the PARTUUID.

What I did to make it work:

  1. Repartitioned the drive to take full advantage of the space
  2. Formatted the drive using mkfs.ext4 to create a new ext4 filesystem
  3. Copied the data from the SD card to the new drive with rsync -ax
  4. Retrieved the PARTUUID via lsblk -o NAME,PARTUUID
  5. Created an initramfs with mkinitramfs -o initrd.sda
  6. Added initramfs initrd.sda to config.txt
  7. Replaced the root= lines in config.txt and cmdline.txt with root=PARTUUID=partuuid
  8. Added rw to cmdline.txt to mount filesystem as read-write and not read-only

Changes to boot files: config.txt:

root=PARTUUID=partuuid
initramfs initrd.sda

cmdline.txt:

console=serial0,115200 console=tty1 root=PARTUUID=partuuid rootfstype=ext4 elevator=deadline fsck.repair=yes rw rootwait

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.