if so, an example of /etc/exports
# nfsv4
V4: /data
/data/nfsShare
# to mount the share: mount -o nfsv4 server:/nfsShare /mnt
# nfsv3
/usr/ports
# to mount the share: mount server:/usr/ports /media
/etc/rc.conf
nfs_server_enable="YES"
nfsv4_server_enable="YES"
A quick web search shows, mounting nfsv4 on Android requires the Android devices Linux nfs kernel module must support nfsv4. if it does, it would depend on the mount arguments (options).If I try to mount an NFS share from Android, does it default to V4?
I'm still inclear as to whether you can have both v3 and v4 shares in the same /etc/exports...A quick web search shows, mounting nfsv4 on Android requires the Android devices Linux nfs kernel module must support nfsv4. if it does, it would depend on the mount arguments (options).
Android client, hypothetical use case (mount(8) here Linux command, see also nfs(8) EXAMPLES):
NFSv4: mount -t nfsv4 nfsserver:/path [mountpoint]
NFSv3: mount nfsserver:/path [mountpoint]
You can. I have a test VM running, having both NFS version shares exported from the same file:I'm still inclear as to whether you can have both v3 and v4 shares in the same /etc/exports...
nfs_server_enable="YES"
nfsv4_server_enable="YES"
V4: /data
# NFSv4
/data/nfsShare
# NFSv3
/usr/src
mount -o nfsv4 14nfss:/nfsShare /mnt
mount 14nfss:/usr/src /media
mount | grep -E 'mnt|media'
14nfss:/nfsShare on /mnt (nfs, nfsv4acls)
14nfss:/usr/src on /media (nfs)
nfsstat -m
14nfss:/nfsShare on /mnt
nfsv4,minorversion=2,tcp,resvport,nconnect=1,hard,cto,sec=sys,acdirmin=3,acdirmax=60,acregmin=5,acregmax=60,nametimeo=60,negnametimeo=60,rsize=65536,wsize=65536,readdirsize=65536,readahead=1,wcommitsize=4194304,timeout=120,retrans=2147483647
14nfss:/usr/src on /media
nfsv3,tcp,resvport,nconnect=1,hard,cto,lockd,sec=sys,acdirmin=3,acdirmax=60,acregmin=5,acregmax=60,nametimeo=60,negnametimeo=60,rsize=65536,wsize=65536,readdirsize=65536,readahead=1,wcommitsize=4194304,timeout=120,retrans=2
No, only one V4: root directory can be specified. The V4: line doesn't export any file system, to export NFSv4 directories (ZFS data sets) they must be set in a seperate line (see exports(5) EXAMPLES and nfsv4(4))Do you need to include V4: /somefolder
before each share defined as a v4 share, otherwise it defined as a V3 share?
V4: /storage
# NFSv4
/storage/packages14 -ro -network 192.168.1.0
/storage/packages13 -ro -network 192.168.1.0
# NFSv3
/usr/ports -ro -network 192.168.1.0
/usr/src-14.0 -ro -network 192.168.1.0
/usr/obj -ro -network 192.168.1.0
/usr/ports -ro -network 10.0.2.0
/usr/src-14.0 -ro -network 10.0.2.0
/usr/obj -ro -network 10.0.2.0
nfs_server_enable="YES"
nfsv4_server_enable="YES"
/etc/exports
. service nfsd restart
start both services? showmount -e 'nfsserver'
shows the original settingThe mountd(8) must be restarted to read the modified /etc/exports file.And how to tell if my /etc/exports has been activated?
service mountd onerestart
32.3.1. Configuring the Server
To enable the processes required by the NFS server at boot time, add these options to /etc/rc.conf:
rpcbind_enable="YES"
nfs_server_enable="YES"
mountd_enable="YES"
Is there any way to make this work?The mountd(8) must be restarted to read the modified /etc/exports file.
service mountd onerestart
"onerestart" (and not restart) because "mountd_enable" is not set in /etc/rc.conf, it doesn't need to be, as doesn't /etc/rc.d/rpcbind, as adviced in the handbook [1].
/etc/rc.d/nfsd is force starting /etc/rc.d/mountd and mountd /etc/rc.d/rpcbind.
V4: /repo
/repo/backup/clonezilla -mapall="root"
/ -mapall="root"
Bummer!Is there any way to make this work?
Code:V4: /repo /repo/backup/clonezilla -mapall="root" / -mapall="root"
zfs create -o mountpoint=/repo zroot/repo
mkdir -p /repo/backup/clonezilla
zfs create -p zroot/repo/backup/clonezilla
NAME MOUNTPOINT
zroot/ROOT/default /
zroot/repo /repo
zroot/repo/backup /repo/backup
zroot/repo/backup/clonezilla /repo/backup/clonezilla
Bummer!
root@M73:~ # mount
zroot/ROOT/default on / (zfs, NFS exported, local, noatime, nfsv4acls)
devfs on /dev (devfs)
zroot/var/audit on /var/audit (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/usr/home on /usr/home (zfs, local, noatime, nfsv4acls)
zroot on /zroot (zfs, local, noatime, nfsv4acls)
zroot/var/crash on /var/crash (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/usr/ports on /usr/ports (zfs, local, noatime, nosuid, nfsv4acls)
zroot/var/tmp on /var/tmp (zfs, local, noatime, nosuid, nfsv4acls)
zroot/tmp on /tmp (zfs, local, noatime, nosuid, nfsv4acls)
zroot/usr/src on /usr/src (zfs, local, noatime, nfsv4acls)
zroot/var/log on /var/log (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/var/mail on /var/mail (zfs, local, nfsv4acls)
No problem, I'm very grateful for the guidance.Now "/repo" and "/" are separate file systems and can be exported with different NFS version protocols as shown in the above examples.
Code:NAME MOUNTPOINT zroot/ROOT/default / zroot/repo /repo zroot/repo/backup /repo/backup zroot/repo/backup/clonezilla /repo/backup/clonezilla
Sorry for the confusion.
Good, glad to hear.Actually my server is using ZFS...
It can stay that way, you need only to create a "repo" data set, to put it on a separate file system than "/" (which is zroot/ROOT/default).Should my /etc/exports be written differently?
Or "backup" and "clonezilla" can be separate data sets (after creating zroot/repo):Code:zfs create -o mountpoint=/repo zroot/repo mkdir -p /repo/backup/clonezilla
Code:zfs create -p zroot/repo/backup/clonezilla
/repo
is the root of V4:, then "/" can't be exported as NFSv3, because they are part of the same file system (zroot/ROOT/default).[root@X1 ~]# showmount -e 192.168.1.14
Exports list on 192.168.1.14:
/ Everyone
/repo/backup/clonezilla Everyone
[root@X1 ~]# mount -o nfsv4 192.168.1.14:/repo/backup/clonezilla /mnt/tmp
mount_nfs: nmount: /mnt/tmp, Invalid fstype: Invalid argument
mount
now includes The path in server:path is specified wrong.mount -o nfsv4 192.168.1.14:/repo/backup/clonezilla /mnt/tmp
V4: /repo
the path begins after /repo./repo/backup/clonezilla
the path in server:path at the mount command begins with /backup: mount -o nfsv4 192.168.1.14:/backup/clonezilla /mnt/tmp
DESCRIPTION
Since the NFSv4 file system is rooted at ``<rootdir>'', setting this to
anything other than ``/'' will result in clients being required to use
different mount paths for NFSv4 than for NFS Version 2 or 3.
EXAMPLES
In the following example some directories are exported as NFSv3 and
NFSv4:
V4: /wingsdl/nfsv4
/wingsdl/nfsv4/usr-ports -maproot=root -network 172.16.0.0 -mask 255.255.0.0
/wingsdl/nfsv4/clasper -maproot=root clasper
Only one V4: line is needed or allowed to declare where NFSv4 is rooted.
The other lines declare specific exported directories with their absolute
paths given in /etc/exports.
The exported directories' paths are used for both v3 and v4. However,
they are interpreted differently for v3 and v4. A client mount command
for usr-ports would use the server-absolute name when using nfsv3:
mount server:/wingsdl/nfsv4/usr-ports /mnt/tmp
A mount command using NFSv4 would use the path relative to the NFSv4
root:
mount server:/usr-ports /mnt/tmp