Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jun 2022 14:44:06 +0000
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        John-Mark Gurney <jmg@funkthat.com>, "freebsd-net@FreeBSD.org" <freebsd-net@FreeBSD.org>
Subject:   Re: make NFSv3 default now on diskless
Message-ID:  <YQBPR0101MB97426750C2E6717B06983AC7DDDE9@YQBPR0101MB9742.CANPRD01.PROD.OUTLOOK.COM>
In-Reply-To: <20220602032456.GY88842@funkthat.com>
References:  <20220602032456.GY88842@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help
John-Mark Gurney <jmg@funkthat.com> wrote:=0A=
> I just booted FreeBSD-current diskless, using NFS root, and I ended=0A=
> up having issues because by default, NFS root is only v2.=0A=
>=0A=
> One of things that happened was disk space available was listed as=0A=
> -138G, or -144830429K.  I assume this is because the server is reporting=
=0A=
> TBs instead.=0A=
Yes. NFSv2 uses 32bit sizes.=0A=
=0A=
> If I mount via mount_nfs, the sizes are normal/correct because it mounts=
=0A=
> v3.=0A=
I believe most specify "nfsv3" in the "/" mount line of /etc/fstab on the=
=0A=
remote root fs. Then, when the system does a "mount -u" to make it=0A=
read/write it gets toggled to NFSv3.=0A=
=0A=
> The other issue that I ran into is that NFSv2 can't access >4GB files=0A=
> (or create them).=0A=
As above, NFSv2 uses 32bit sizes.=0A=
=0A=
> Anyone object to adding BOOTP_NFSV3 to GENERIC?=0A=
Well, that option only works when used with BOOTP_NFSROOT.=0A=
The GENERIC configs for amd64, arm64,... use the other way.=0A=
(Just to make it confusing, there are two different ways an NFS root=0A=
 fs is set up.)=0A=
See below.=0A=
=0A=
>  Or maybe making it a=0A=
> tunable that defaults to set, because it seems a bit crazy to default=0A=
> to v2 these days.=0A=
I don't think changing the default to NFSv3 will be a problem.=0A=
The reason it was NFSv2 was that,=0A=
for some non-FreeBSD NFS servers, the NFSv3 file handle is different=0A=
than the NFSv2 one.=0A=
=0A=
I added NFSv3 support to stand/libsa/nfs.c about 15years ago, so every=0A=
system should be running the newer NFS code in the loader and be able=0A=
to do NFSv3 booting.=0A=
=0A=
> This option was added in 432aad0e in 1997 so that the nfs_diskless=0A=
> structure didn't need to be filled out.  Does anything even=0A=
> populate/fill it out anymore?  I saw code in i386/i386/locore.s that=0A=
> does this, but it doesn't appear anywhere else.=0A=
Yes. For "options NFS_ROOT" (the other way), the loader uses=0A=
"stand/libsa/nfs.c" to acquire the remote file system's root file handle=0A=
and fills it in. (See nfs_setup_diskless() in sys/nfs/nfs_diskless.c.)=0A=
Looking at it, it appears to enable NFSv3 so long as it finds=0A=
"boot.nfsroot.nfshandlelen" set.=0A=
=0A=
> There also appears to possibly be a way via mount options, but I can't=0A=
> see where it's documented to set them.=0A=
I think you just specify "nfsv3" as a mount option in the root fs=0A=
line in /etc/fstab on the root fs on the NFS server.=0A=
=0A=
I don't think changing the default to NFSv3 will be a problem.=0A=
The hassle is testing the various cases, to make sure nothing=0A=
breaks. I have no diskless setup to do testing and I don't even know=0A=
when installs/upgrades actually replace the loader?=0A=
=0A=
rick=0A=
=0A=
--=0A=
  John-Mark Gurney                              Voice: +1 415 225 5579=0A=
=0A=
     "All that I will do, has been done, All that I have, has not."=0A=
=0A=
=0A=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YQBPR0101MB97426750C2E6717B06983AC7DDDE9>