A Gentle Introduction to ZFS, Part 3: Network File Systems and iperf3 Testing

What are Network File Systems?

IETF Logo
$ sudo apt install build-essential make autogen autoconf libtool gawk alien fakeroot curl wget flex bison dkms zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev parted lsscsi ksh libssl-dev libelf-dev nfs-kernel-server open-iscsi watchdog xattr samba samba-client acl smartmontools mailutils nfs4-acl-tools
# Number of servers to start up
RPCNFSDCOUNT=8
# Runtime priority of server (see nice(1))
RPCNFSDPRIORITY=0
# Options for rpc.mountd.
# If you have a port-based firewall, you might want to set up
# a fixed port here using the --port option. For more information,
# see rpc.mountd(8) or http://wiki.debian.org/SecuringNFS
# To disable NFSv4 on the server, specify '--no-nfs-version 4' here
RPCMOUNTDOPTS="--manage-gids"
# Do you want to start the svcgssd daemon? It is only required for Kerberos
# exports. Valid alternatives are "yes" and "no"; the default is "no".
NEED_SVCGSSD=no
# Options for rpc.svcgssd.
RPCSVCGSSDOPTS=""
...[Mapping]

Nobody-User = nobody
Nobody-Group = nogroup
...
$ sudo systemctl start nfs-server
$ sudo systemctl enable rpcbind nfs-server
$ rpcinfo -p | grep nfs
100003 3 tcp 2049 nfs
100003 3 udp 2049 nfs
$ sudo mkdir -p /export/<dataset1>
$ sudo mkdir -p /export/<dataset2>
$ sudo mkdir -p /export/<dataset3>
$ sudo chown -R nobody:nogroup /export
$ sudo chmod -R 0777 /export
Mr. Mackey says you might not want to give 0777 permissions in a production environment.
$ sudo mount --bind /tank/<dataset1> /export/<dataset1>
$ sudo mount --bind /tank/<dataset2> /export/<dataset2>
$ sudo mount --bind /tank/<dataset3> /export/<dataset3>
# /etc/fstab: static file system information. 
#
# These are the filesystems that are always mounted on boot, you can
# override any of these by copying the appropriate line from this file into
# /etc/fstab and tweaking it as you see fit. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/root / ext4 defaults 0 1
/tank/dataset1 /export/dataset1 none bind,defaults,nofail 0 0
/tank/dataset2 /export/dataset2 none bind,defaults,nofail 0 0
/tank/dataset3 /export/dataset3 none bind,defaults,nofail 0 0
# /etc/exports: the access control list for filesystems which may be exported 
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)

/export 192.168.50.0/24(ro,all_squash,anonuid=65534,anongid=65534,no_subtree_check,fsid=0,crossmnt)
/export/dataset1 192.168.50.0/24(rw,async,all_squash,anonuid=65534,anongid=65534,no_subtree_check)
/export/dataset2 192.168.50.0/24(rw,async,all_squash,anonuid=65534,anongid=65534,no_subtree_check)
/export/dataset3 192.168.50.0/24(rw,async,all_squash,anonuid=65534,anongid=65534,no_subtree_check)
$ sudo systemctl restart nfs-server
...[Mapping]
Nobody-User = nobody
Nobody-Group = nogroup
...
$ sudo mkdir -p /mnt/tank
$ showmount -e <server>
Export list for <server>:
/export/<dataset1> 192.168.50.0/24
/export/<dataset2> 192.168.50.0/24
/export/<dataset3> 192.168.50.0/24
/export 192.168.50.0/24
$ sudo mount -t nfs -o proto=tcp,port=2049 <nfs-server-IP>:/export /mnt/tank
$ ls /mnt/tank
dataset1 dataset2 dataset3
$ touch /mnt/tank/test
touch: cannot touch '/mnt/tank/test': Read-only file system
$ touch /mnt/tank/dataset1/test
touch: cannot touch '/mnt/tank/dataset1/test': Permission denied
$ sudo mount -t nfs -o proto=tcp,port=2049 <nfs-server-IP>:/export/dataset1 /mnt/tank/dataset1
$ sudo mount -t nfs -o proto=tcp,port=2049 <nfs-server-IP>:/export/dataset2 /mnt/tank/dataset2
$ sudo mount -t nfs -o proto=tcp,port=2049 <nfs-server-IP>:/export/dataset3 /mnt/tank/dataset3
$ touch /mnt/tank/dataset1/test (success!)
<nfs-server-IP>:/export /mnt/tank nfs auto,user,_netdev 0 0
<nfs-server-IP>:/export/dataset1 /mnt/tank/dataset1 nfs auto,user,_netdev 0 0
<nfs-server-IP>:/export/dataset2 /mnt/tank/dataset2 nfs auto,user,_netdev 0 0
<nfs-server-IP>:/export/dataset3 /mnt/tank/dataset3 nfs auto,user,_netdev 0 0
$ sudo mount -a
$ ls /mnt/tank
dataset1 dataset2 dataset3
Install Client for NFS in Windows Features (Source: GraspingTech)
mount -o anon <nfs-server-ip>:/export/tank X:

iPerf3 Testing

$ sudo apt install iperf3
$ iperf3 --server
$ ip addr | grep eth
[Unit] 
Description=iperf3 service

[Service]
Type=simple
ExecStart=/usr/bin/iperf3 --server > /dev/null &

[Install]
WantedBy=multi-user.target
$ sudo systemctl enable iperf
$ sudo systemctl start iperf
$ sudo apt install iperf3
$ iperf3 --client <server IP address> --bytes 2G
What bits look like travelling down copper… sure, something like that.
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.50.222, port 49916
[ 7] local 192.168.50.201 port 5201 connected to 192.168.50.222 port 49918
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 113 MBytes 944 Mbits/sec 0 409 KBytes
[ 5] 1.00-2.00 sec 112 MBytes 939 Mbits/sec 0 426 KBytes
[ 5] 2.00-3.00 sec 111 MBytes 932 Mbits/sec 0 445 KBytes
[ 5] 3.00-4.00 sec 112 MBytes 937 Mbits/sec 0 445 KBytes
[ 5] 4.00-5.00 sec 111 MBytes 930 Mbits/sec 0 467 KBytes
[ 5] 5.00-6.00 sec 111 MBytes 932 Mbits/sec 0 467 KBytes
[ 5] 6.00-7.00 sec 111 MBytes 934 Mbits/sec 0 488 KBytes
[ 5] 7.00-8.00 sec 111 MBytes 935 Mbits/sec 0 488 KBytes
[ 5] 8.00-9.00 sec 111 MBytes 935 Mbits/sec 0 488 KBytes
[ 5] 9.00-10.00 sec 111 MBytes 935 Mbits/sec 0 488 KBytes
[ 5] 10.00-11.00 sec 111 MBytes 933 Mbits/sec 0 488 KBytes
[ 5] 11.00-12.00 sec 112 MBytes 942 Mbits/sec 0 691 KBytes
[ 5] 12.00-13.00 sec 111 MBytes 933 Mbits/sec 0 691 KBytes
[ 5] 13.00-14.00 sec 111 MBytes 933 Mbits/sec 0 691 KBytes
[ 5] 14.00-15.00 sec 111 MBytes 933 Mbits/sec 0 691 KBytes
[ 5] 15.00-16.00 sec 111 MBytes 932 Mbits/sec 0 691 KBytes
[ 5] 16.00-17.00 sec 111 MBytes 934 Mbits/sec 0 691 KBytes
[ 5] 17.00-18.00 sec 111 MBytes 933 Mbits/sec 0 691 KBytes
[ 5] 18.00-18.37 sec 42.5 MBytes 953 Mbits/sec 0 691 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-18.37 sec 2.00 GBytes 935 Mbits/sec 0 sender
[ 5] 0.00-18.37 sec 2.00 GBytes 934 Mbits/sec receiver

iperf Done.

Known Issues

$ sudo df -hH
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p1 30G 17G 12G 61% /
none 4.1G 0 4.1G 0% /dev
tmpfs 4.2G 4.1k 4.2G 1% /dev/shm
tmpfs 4.2G 51M 4.1G 2% /run
tmpfs 5.3M 4.1k 5.3M 1% /run/lock
tmpfs 4.2G 0 4.2G 0% /sys/fs/cgroup
tmpfs 825M 13k 825M 1% /run/user/120
tank 21T 525k 21T 1% /tank
tmpfs 825M 0 825M 0% /run/user/1000
$ sudo df -hH
Filesystem Size Used Avail Use% Mounted on
...
nfssrv:/export 30G 17G 12G 61% /mnt/himalayan
nfssrv:/export/dataset1 30G 17G 12G 61% /mnt/himalayan/photos
nfssrv:/export/dataset2 30G 17G 12G 61% /mnt/himalayan/shinobi
nfssrv:/export/dataset3 30G 17G 12G 61% /mnt/himalayan/video
...
$ df -i /tank 
Filesystem Inodes IUsed IFree IUse% Mounted on
tank 40301147711 6 40301147705 1% /tank
$ sudo mount -v -t nfs -o rw,nfsvers=3 server:/tank/dataset1 /mnt/tank/dataset1
mount.nfs: timeout set for Wed Jan 20 08:50:55 2021
mount.nfs: trying text-based options 'nfsvers=3,addr=192.168.51.200'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.51.200 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.51.200 prog 100005 vers 3 prot UDP port 39972
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting server:/tank/dataset1
$ sudo systemctl stop autofs
$ sudo automount -f -v

Summary

Next Article

Further Resources

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store