I broke a few microsd due to too many writes on the rpi4, so I’m looking into going full usb.
I am also using it as a custom small NAS, with 2x4TB hd
…so I also need GPT, otherwise I would waste half of the disks with only MBR.
So I took my usb key and started doing tests:
My strategy was (tested first with raspberry-os)
flash the latest successful hydra build on a usb key (don’t boot yet, gpt requires some space at the end of the disk and at first boot the os will resize to max space, making you unable to create a gpt without manually resizing down again)
gdisk /dev/your_usb_key
if asked, select 1 - MBR and ignore possible old corrupt backup GPT
xrf (advanced, recovery, load from MBR to create GPT Note: we might have now changed the partitions GUID)
unclear if the next step are needed, probably not. I did it anyway in case the boot process kept looking for the MBR partition
h (make hybrid MBR)
1 2 (select gpt partition 1 and 2 to be written to mbr)
N (first partition is NOT EFI GPT)
0b N (first gpt partition will become first mbr, type 0b, non bootable)
83 Y (second gpt partition will become second mbr, type 83, bootable)
o and p to print the MBR and GPT tables
N, m (Ignore additional space, go to normal menu)
t1ef00w (type of first partition to ef00, then write and exit)
This works up until u-boot, which recognizes the usb key, but then goes directly to network boot.
After many little variations in how the partitions were (re)created, forcing the new partitions to have the same GUIDs as the old ones I never went further.
Has anyone tried anything similar? Any info on what u-boot needs and why it can’t go further?
Don’t really know for sure, but I did lots of tests and left running an almost empty system with 5-6 containers (samba, freeipa, pihole, nextcloud and more) for a couple of months.
The containers (podman) were on the hard disk though (both the base and the mounted dirs), so my guess is that it probably was a lot of logging through journald. No active services should have touched the microsd.
…
Going back on topic, I think the problem I have with booting is with 4TB drives + gpt and u-boot.
Basically I found out I can easily boot with GPT no problem…on a 8GB usb key.
I can not on a 4TB drive, the errors I have are related to wrong GPT signatures.
Something tells me it’s u-boot, maybe it’s the 32bit version and drives > 2TB require the 64bit version, but I am not sure and I do not know how to verify or test.
/*
* NOTE:
* when CONFIG_SYS_64BIT_LBA is not defined, lbaint_t is 32 bits; this
* limits the maximum size of addressable storage to < 2 tebibytes
*/
so maybe it would be enough to recompile u-boot with that defined?
I have zero experience with u-boot unfortunately and I don’t understand nixos enough to recompile u-boot properly