Nfs Share Zfs File System

Posted on by admin
  1. Freebsd Zfs Nfs
  2. Nfs Share Zfs File System Disadvantages

However, using LOFS to share one dataset into two local zones can be risky as hell, if both zones work on same data (read-write)This doesn't make sense. Having multiple processes accessing the same file in r/w mode might be risky regardless of whether the file system is local or not and regardless of the accessing processes running on the same kernel or not. You can lofs mount in read-only mode should you want to avoid that specific issue. On the other hand, it is extremely common to have NFS, cifs or lofs shares in r/w mode and this definitely serves a purpose. File locking is the usual way to avoid multiple processes concurrently accessing the same file.

If you are familiar with, you know all about its feature rich interface, flexible architecture, reliable checksums and COW mechanisms. Maybe you also want it on your desktop, but you don’t want to reformat your existing disks and partitions. Maybe, you are using Windows 10, which doesn’t support OpenZFS,.

Well in this blog post, I will discuss how you can create a Network File System, or NFS, running in a seperate server. This NFS device can then be mounted on your desktop workstation.

This way you can have the reliability and robustness of ZFS with the user friendliness of your favorite Desktop OS, since NFS is available across all platforms.I will detail the creation of NFS mount point on a Windows 10 client in the Part 2 of this series. For now let’s focus on an Ubuntu server offering NFS storage and a Ubuntu client trying to connect to it.

The SetupMy NFS server is going to be based on Ubuntu 18.04 LTS. You can use your favorite Linux distro or FreeBSD, or any other OS that supports OpenZFS. My reason for using Ubuntu 18.04 is that it is quite popular and would considerably reduce the barrier of entry.The NFS is supposed to be available only on my LAN which has the subnet mask of 255.255.255.0 and 192.168.0.1 as its default gateway. In plain English, this means that all the devices connected to my home network (WiFi and Ethernet, et al) will have IP addresses ranging from 192.168.0.2 through 192.168.0.254.The NFS server will be configured to allow only devices with only the aforementioned IP address to be have access to the NFS server.

This would ensure that only devices which have connected to my LAN are accessing my files and the outside world can’t access it. If you have an ‘open Wifi’ setup or if the security on your router’s endpoint is dubious, this would not guarantee any security.I wouldn’t recommend running NFS over public internet without additional security measure.Lastly, the commands being run on the NFS server have the prompt, server $ and the commands to be run on the client side have the prompt client $ Creating OpenZFS pool and Dataset 1. Creating zpoolIf you already have a zpool up and running, skip this step. On my NFS server, which is running Ubuntu 18.04 LTS server, I first install OpenZFS. $ lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTloop0 7: 0 0 89.5M 1 loop /snap /core / 6130loop1 7: 1 0 86.9M 1 loop /snap /core / 4917loop2 7: 2 0 91.1M 1 loop /snap /core / 6259sda 8: 0 0 50G 0 disk├─sda1 8: 1 0 1M 0 part└─sda2 8: 2 0 50G 0 part /sdb 8: 16 0 931G 0 disksdc 8: 32 0 931G 0 disksr0 11: 0 1 1024M 0 romA typical example is shown above, but your naming convention might be wildly different. You will have to use your own judgement, and be very careful about it.

You don’t want to accidentally format your OS disk. For example, the sda1 partition clearly has the root filesystem as its mount point so it is not wise to touch it. If you are using new disks, chances are they won’t have a mount point or any kind of partitioning.Once you know the name of your devices, we will use zpool create command to format a couple of these block devices (called sdb and sdc) into a zpool with a single vdev that is made up of two mirrored disk. Server $ sudo zpool create tank mirror sdb sdcserver $ sudo zpool status tankzpool status tankpool: tankstate: ONLINEscan: none requestedconfig:NAME STATE READ WRITE CKSUMtank ONLINE 0 0 0mirror- 0 ONLINE 0 0 0sdb ONLINE 0 0 0sdc ONLINE 0 0 0errors: No known data errorsMoving forward, you can add disks in sets of two (called vdev) to grow the size of this zpool, the new disks will show up as mirror-1, mirror-2 etc.

Zfs

You don’t have to create your zpool the way I did, you can use mirroring with more disks, you can use striping without redundancy but better performance, or you can use RAIDZ. You can learn more about it.At the end of the day, what matters is that we have created a zpool named tank.

Cti usb driver. Upon which the shared NFS will live. Let’s create a dataset that will be shared. First make sure that the pool, named ‘tank’, is mounted. Default mount point is ‘/tank’. Server $ sudo zfs mount tankserver $ sudo zfs create tank /nfsshare #create a new dataset on top of the pool Setting PermissionsWhen sharing an NFS directory, the superuser on the client system doesn’t have access to anything on the share. While the client-side superuser is capable of doing anything on the client machine, the NFS mount is technically not a part of the client machine.

Freebsd Zfs Nfs

So allowing operations on behalf of the client-side superuser mapped as server-side superuser could result in security issues. By default, NFS maps the client-side superuser actions to nobody:nogroup user and user group. If you intend on accessing the mounted files as root, then dataset on our NFS server should also have the same permissions. Client $ mount -t nfs server.ip: /tank /nfsshare /mntThis will mount the NFS share on /mnt folder but you could have just as easily picked any other mount point of your choice.

ConclusionFile sharing is probably the most important aspect of system administration. It is improves your understanding of the storage stack, networking, user permissions and privileges.

You will quickly realize the importance of Principle of Least Privilege — That is to say, only give a user the barest possible access that it needs to its job.You will also learn about the interoperability between different operating systems. Windows users can access NFS files, so can the Mac and BSD users.

Nfs Share Zfs File System Disadvantages

NfsFile

You can’t restrict yourself to one OS when dealing with a network of machines all having their own conventions and vernacular. So go ahead and experiment with your NFS share. I hope you learned something.