I have my raspbian OS located on a 3TB external harddrive only some bootmanager stuff left on the SD Card. (if i remember right i followed this guide)

I want it to boot from the sd card ONLY if there is no USB Drive available to boot from. I edited the cmdline.txt file which is containing the following by default root=/dev/mmcblk0p2 to root=/dev/sda2.

Can i add some BASH logic in here?

2 Answers 2


I think it is not simple to achieve.

cmdline.txt contains kernel arguments and one of them is root= argument. There is no way to achieve simple failover as root= accepts only one device.

My suggestion is to make two SD cards, one with root=/dev/mmcblk0p2 and one with root=/dev/sda1 and switch them based on what you plug in.

Another solution, also good one, is that you always boot from SD card root=/dev/mmcblk0p2 and put your /dev/sda1 into /etc/fstab so it mounts on /mnt on boot, if it is plugged in.

  • the last solution is not really satisfying for me because the OS is then run on the SD Card. I moved the OS to the Hard Drive to prevent SD Card Corruption and i was told it runs more stable. So I guess i'd have to go with two seperate SD Cards .. thanks for explaining the cmdline.txt though.
    – philx_x
    Commented Feb 18, 2015 at 6:55

There is no seperate BIOS hidden on the Pi == the SD card IS the BIOS and system 'all in one'.

However, since the SD will always be present, it should be quite possible to have it 'cross boot' to the external hard drive (after loading the GPIO 'blob' & uSB 'drivers') .. in 'nix world, go look up GRUB ...

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.