rim
Posts: 6
Joined: Sat Mar 03, 2012 3:22 pm

NFS Boot with fall back to local image

Wed Jul 01, 2015 4:11 am

I have a Pi booting by NFS using the following in cmdline.txt:

Code: Select all

dwc_otg.lpm_enable=0 ip=dhcp root=/dev/nfs nfs-options=hard,intr,rw
It's basic and functions well. I want to augment it so that it will boot from the local SD card if the NFS mount is unavailable. What do I need to add to generate that functionality?

Thanks,
Ian

User avatar
rpdom
Posts: 17447
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: NFS Boot with fall back to local image

Wed Jul 01, 2015 7:16 am

I don't believe the kernel has any fall-back capabilities, so what you ask isn't possible.

rim
Posts: 6
Joined: Sat Mar 03, 2012 3:22 pm

Re: NFS Boot with fall back to local image

Wed Jul 01, 2015 8:52 pm

Is there another way to net boot a Raspberry Pi that would allow this type of behaviour?

myoung008
Posts: 55
Joined: Mon Mar 18, 2013 9:56 pm

Re: NFS Boot with fall back to local image

Thu Jul 02, 2015 1:57 am

You could create a very small root file system that attempts to mount the nfs first, and if it fails it mounts the real local root, then pivot_root. The kernel command line would point to the small filesystem.

rim
Posts: 6
Joined: Sat Mar 03, 2012 3:22 pm

Re: NFS Boot with fall back to local image

Sun Jul 05, 2015 3:47 am

Thanks myoung008.

Does anyone know of a good tutorial for setting up pivot_root?

myoung008
Posts: 55
Joined: Mon Mar 18, 2013 9:56 pm

Re: NFS Boot with fall back to local image

Mon Jul 06, 2015 5:05 am

I don't know of any tutorials, but it's the way you switch from an initrd to the real root filesystem. Most linux live CD/DVDs will have scripts in their initrds that you can look at/modify to your needs.

bobMuk
Posts: 6
Joined: Wed Aug 14, 2013 4:47 pm

Re: NFS Boot with fall back to local image

Mon Jul 24, 2017 10:49 am

Did you get anywhere with using pivot_root for this? I have exactly the same requirement and can't get it to work.

beta-tester
Posts: 1385
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: NFS Boot with fall back to local image

Mon Jul 24, 2017 11:28 am

maybe you can "misuse" NOOBS to boot to local stored system or netboot by choice. possibly some adjustments in the source code of NOOBS is required to do not boot from another partition - instead using the simple the cmdline for a netboot.
{ I only give negative feedback }
RPi B (256MB), B (512MB), B+, ZeroW; 2B; 3B, 3B+; 4B (4GB)

Return to “Advanced users”