NFS and diskless: some questions re nfs_diskless.c

Rick Macklem rmacklem at uoguelph.ca
Tue Feb 17 01:57:03 UTC 2015


Beeblebrox wrote:
> Well, I removed all the BOOTP* items from config and re-built kernel.
> 
> * With FreeBSD's pxeboot everything works normally and root is
> mounted as NFSv3. dhcp.conf has option root-path defined.
> 
> * When trying to use Grub, boot stops at the "mountroot>" prompt,
> wich was the original problem as far as I recall. The grub.cfg file
> already passes these params to the FreeBSD kernel to no avail:
> vfs.root.mountfrom="nfs:192.168.2.1:/data/amd64"
I believe the syntax for this is:
vfs.root.mountfrom=nfs:/data/amd64
but I'm not sure.
Here`s the comment from vfs_mountroot.c for this:
        * The root filesystem is detailed in the kernel environment variable
72 	* vfs.root.mountfrom, which is expected to be in the general format
73 	*
74 	* <vfsname>:[<path>][ <vfsname>:[<path>] ...]
75 	* vfsname := the name of a VFS known to the kernel and capable
76 	* of being mounted as root
77 	* path := disk device name or other data used by the filesystem
78 	* to locate its physical store
79 	*
80 	* If the environment variable vfs.root.mountfrom is a space separated list,
81 	* each list element is tried in turn and the root filesystem will be mounted
82 	* from the first one that suceeds.
83 	*
84 	* The environment variable vfs.root.mountfrom.options is a comma delimited
85 	* set of string mount options. These mount options must be parseable
86 	* by nmount() in the kernel.
> boot.nfsroot.server="192.168.2.1"
> boot.nfsroot.path="/data/amd64"
> 
These 2 lines cover the information and are used for NFS_ROOT.
(I'd just get rid of vfs.root.mountfrom if you are going to use
 NFS_ROOT.)

>From nfs_diskless.c, here is the list of environment variables used
by the NFS_ROOT case:
        * Populate the essential fields in the nfsv3_diskless structure.
147 	*
148 	* The loader is expected to export the following environment variables:
149 	*
150 	* boot.netif.name name of boot interface
151 	* boot.netif.ip IP address on boot interface
152 	* boot.netif.netmask netmask on boot interface
153 	* boot.netif.gateway default gateway (optional)
154 	* boot.netif.hwaddr hardware address of boot interface
155 	* boot.nfsroot.server IP address of root filesystem server
156 	* boot.nfsroot.path path of the root filesystem on server
157 	* boot.nfsroot.nfshandle NFS handle for root filesystem on server
158 	* boot.nfsroot.nfshandlelen and length of this handle (for NFSv3 only)
159 	* boot.nfsroot.options NFS options for the root filesystem

Alternately, set vfs.root.mountfrom and put all three of these
options back in your kernel config.
options BOOTP
options BOOTP_NFSROOT
options BOOTP_NFSV3    <-- this one gets the BOOTP* case to use NFSv3

rick
ps: All I do when trying to answer these questions is look in the sources.
    (To me, that`s what open source is all about.)
> --
> FreeBSD_amd64_11-Current_RadeonKMS
> _______________________________________________
> freebsd-net at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to
> "freebsd-net-unsubscribe at freebsd.org"
> 


More information about the freebsd-net mailing list