Hacker News new | past | comments | ask | show | jobs | submit login

You can do this with Linux easily as long as your bios allows you to boot from USB. Just put /boot on the USB and everything else on the NVMe (via PCI Express to NVMe card). This trick has allowed me to save several old PCs and use them as home servers and for my home lab.



> Just put /boot on the USB and everything else on the NVMe

Hold up - that works? I’ve got a SBC device that has to boot off sd card but has ssd attached.

Any pointers as to where I could read up more on how to split a fs system like that? I can copy files easily enough but presumably needs so additional magic to link/integrate it


Believe it or not, you don't even need a physical disk to boot at all (on many systems).

The first step in the boot process is loading the boot firmware. On a BIOS/UEFI PC, this gives you Preboot Execution Environment (PXE) [0]. Raspberry Pi boards have something similar since the Pi 3, though it's not exactly PXE. Network booting allows you to setup a DHCP server in a way that automatically serves the machine a kernel, initramfs, and cmdline over the network. You can run a full Linux that way, though you probably want to switch_root [1] to another filesystem that has a block device backing it with more storage, for practical purposes. This is what most initramfs images do.

Once the machine can automatically retrieve those three, you're set. The initramfs can be built with whatever binaries, firmware, and kernel modules you need to initialize the network and set up an NBD or NFS share. Add `root=/dev/nbd0` or whatever, and you're running over the network.

Same concept applies to booting with a split boot partition. The boot partition contains the kernel, initramfs, and bootloader, along with the boot configuration. The kernel cmdline specifies which disk contains the root filesystem. It need not be on the same disk as the kernel, or even on the same machine.

[0] https://en.wikipedia.org/wiki/Preboot_Execution_Environment

[1] https://landley.net/writing/rootfs-programming.html


Many thanks for the detailed response. This is probably the part that was missing in my mind

>The kernel cmdline specifies which disk contains the root filesystem.


Absolutely. It's a part of the kernel I find very interesting.

Here's a related bit from the kernel docs that describes the initramfs and switch_root in more detail.

https://www.kernel.org/doc/Documentation/filesystems/ramfs-r...

Interestingly, there's even a mechanism for leaving programs running even after exiting the initramfs.


Possibly you may be get by installing normally on NVMe; `cp -R /mnt/nvme0p1/boot /mnt/mmcblk0p1/boot`; `sudo reboot`. There shall be requisite kernel modules and /etc/fstab inside initramfs to find `nvme0` and chroot into it.

It ultimately should not matter how Kernel + initramfs finds itself on RAM, or whether it was loaded from what it thinks it was loaded from. Kernel is just a baremetal program, and BIOS/firmware is just the least elaborate tool to make Kernel appear on RAM.


I'm doing something similar with the VisionFive 2, boot is on the SD card, the NVME does the rest.


Note that current u-boot (latest official fw release, u-boot patches already upstreamed) can boot straight from NVME.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: