2

I have a doubt about boot process, is possible set boot partition from boot if /dev/root fails? like a grub select. I prefer no use berryboot and my install is noobs based. My idea is set a boot partition failover for data corruption on SD card. Any ideas?

  • The Pi ONLY boots from the first partition on the SD card. – joan Dec 2 '15 at 12:07
  • Is possible have more than 1 partitions and change boot.txt to select it? – Angeloide Dec 2 '15 at 12:16
  • Your question is vague. cmdline.txt contains root=/dev/mmcblk0p2 (at least for Rasbpian different if NOOBS). You can change this to a different partition (provided \etc\fstab is correctly set in the partition). I don't normally bother with multi-boot on a Pi. A 8GB SD costs $7 - I just swap SD). – Milliways Dec 2 '15 at 12:20
  • 2
    Yes, not for the price, really If you put a raspy in a remote place very far to you and raspi loss power then you got SD data corruption, but If you have a 2 or more cloned partitions raspi go alive and boot from other using watchdog whitout use your system on USB (already occupied by 3g modem). Maybe is bad explained, sorry my bad english. – Angeloide Dec 2 '15 at 12:38
  • I'd just want to mention booting raspbian over NFS if there is another machine on the network. No filesystem on the SD card. Just files for booting. – user236012 Dec 2 '15 at 13:33
1

No. You could (I believe this is what something like berryboot probably does; I haven't used it) load a minimal root fs, possibly from an initramfs, present the user with options, and then switch the root filesystem (which is what initramfs kernels always do), but obviously there is a bit of work involved.

Alternately, you could write your own bootloader code, but this is even more work, and may require some proprietary knowledge (I'm not sure).

  • I think you can load busybox (grub, or that new bootloader) onto the boot partition, from which you can then use some logic to start a kernel on any other parition. Just something I read somewhere. But you need to compile the boot.img with all this.. that didnt look to easy for me. – Piotr Kula Dec 2 '15 at 19:40
  • @ppumkin No, you would need a kernel before busybox, which can be used as a drop-in for init without needing a rootfs. It can't act as it's own kernel. So similar to the initramfs idea. Note you can built an initramfs into the kernel, presumably one including busybox -- although don't think there would be much advantage to that, because you might as well just load an initramfs from the first partition. – goldilocks Dec 2 '15 at 19:44
  • Ahh.. right. So I wonder if he could put a busybox kernel on the default parition where Raspbain would be (EXT2) not on the (FAT), and from the busybox chain load the actual kernel he needs, like from NFS or whatever. He could use a 8MB SD Card (if that is even supported) - Yea? – Piotr Kula Dec 2 '15 at 19:46
  • raspberrypi.org/blog/boot-from-a-16mb-sd-card - This links to a tutorial where they use a custom bootloader and change something in a text editor to direct from where to chain load the actual kernel. Pretty cool, but the filesytem needs to be mounted/accessible though, ie USB drive. – Piotr Kula Dec 2 '15 at 19:49
  • "from the busybox chain load" -> That's sort of what I'm saying about the initramfs -- which normally is basically a lot like busybox, an init plus some utilities (and kernel modules, but the relevant stuff is just built in on the pi). You can do whatever you want in it, it's a tiny OS. That includes various ways to switch the seat of the root filesystem. Except I don't see the point in chainloading a different kernel unless you want something non-linux -- dunno what the options there would be. – goldilocks Dec 2 '15 at 19:51
0

You need to edit /boot/cmdline.txt and define root=PARTUUID=, for example root=PARTUUID=1e4c4b75-02

You can have multiple partitions, up to 3 (except boot one), with different OS.

To find your destinated PARTUUID you can use this command:

ls -l /dev/disk/by-partuuid/

Each of rootfs partitions have to have own /etc/fstab with its PARTUUID

You can prepare two folders /boot/os1 and /boot/os2 with separated kernels/cmdline.txt. Than just move content of needed os to /boot and it works just like full separated dual boot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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