Re: make NFSv3 default now on diskless
- In reply to: Rick Macklem : "Re: make NFSv3 default now on diskless"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 02 Jun 2022 15:41:47 UTC
Rick Macklem <rmacklem@uoguelph.ca> wrote: > John-Mark Gurney <jmg@funkthat.com> wrote: > > I just booted FreeBSD-current diskless, using NFS root, and I ended > > up having issues because by default, NFS root is only v2. > > > > One of things that happened was disk space available was listed as > > -138G, or -144830429K. I assume this is because the server is reporting > > TBs instead. > Yes. NFSv2 uses 32bit sizes. > > > If I mount via mount_nfs, the sizes are normal/correct because it mounts > > v3. > I believe most specify "nfsv3" in the "/" mount line of /etc/fstab on the > remote root fs. Then, when the system does a "mount -u" to make it > read/write it gets toggled to NFSv3. > > > The other issue that I ran into is that NFSv2 can't access >4GB files > > (or create them). > As above, NFSv2 uses 32bit sizes. > > > Anyone object to adding BOOTP_NFSV3 to GENERIC? > Well, that option only works when used with BOOTP_NFSROOT. > The GENERIC configs for amd64, arm64,... use the other way. > (Just to make it confusing, there are two different ways an NFS root > fs is set up.) > See below. > > > Or maybe making it a > > tunable that defaults to set, because it seems a bit crazy to default > > to v2 these days. > I don't think changing the default to NFSv3 will be a problem. > The reason it was NFSv2 was that, > for some non-FreeBSD NFS servers, the NFSv3 file handle is different > than the NFSv2 one. > > I added NFSv3 support to stand/libsa/nfs.c about 15years ago, so every > system should be running the newer NFS code in the loader and be able > to do NFSv3 booting. > > > This option was added in 432aad0e in 1997 so that the nfs_diskless > > structure didn't need to be filled out. Does anything even > > populate/fill it out anymore? I saw code in i386/i386/locore.s that > > does this, but it doesn't appear anywhere else. > Yes. For "options NFS_ROOT" (the other way), the loader uses > "stand/libsa/nfs.c" to acquire the remote file system's root file handle > and fills it in. (See nfs_setup_diskless() in sys/nfs/nfs_diskless.c.) > Looking at it, it appears to enable NFSv3 so long as it finds > "boot.nfsroot.nfshandlelen" set. Just to give you a little more on how these two methods work (from my vague recollection..): options NFS_ROOT - Something (usually PXEBOOT) loaded the loader. - The loader filled in some environment variables using the code in stand/libsa/nfs.c. boot.nfsroot.nfshandle - The root fs file handle boot.nfsroot.nfshandlelen - The length of above (if not set, use NFSv2) - plus some others to set up the network interface - The kernel uses these environment variables to fill in nfs_diskless or nfsv3_diskless. This is done by the function called nfs_setup_diskless(), found in sys/nfs/nfs_diskless.c. options BOOTP_NFSROOT - Kernel gets loaded somehow. - Kernel uses code in sys/nfs/bootp_subr.c to get the information needed (such as the root fs file handle) via BOOTP/DHCP. For this one, it will use NFSv2 unless "options BOOTP_NFSV3" was specified along with "options BOOTP_NFSROOT" in the kernel config. If you are using the "NFS_ROOT" approach, I am surprised that you get NFSv2, since the code in stand/libsa/nfs.c appears to do NFSv3 now and sets "boot.nfsroot.nfshandlelen", unless I am mis-reading it? - Maybe you can pop out into the loader and look at the environment variables with "show"? rick > There also appears to possibly be a way via mount options, but I can't > see where it's documented to set them. I think you just specify "nfsv3" as a mount option in the root fs line in /etc/fstab on the root fs on the NFS server. I don't think changing the default to NFSv3 will be a problem. The hassle is testing the various cases, to make sure nothing breaks. I have no diskless setup to do testing and I don't even know when installs/upgrades actually replace the loader? rick -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."