Friday, March 27, 2009

ZFS sharing over NFS

These are some instructions for setting up a NFS share in OpenSolaris with ZFS commands.

My plan is to share a secondary drive installed in my PC to other computers using NFS protocol. I am using a 260 GB drive that is connected to the SATA port inside the computer. First we need to make sure that the drive is formatted properly and ZFS pool is set right.

You might want to take a look at the other ZFS references on our site before continuing.

My information: 2.5" Hitachi drive, capacity 260GB RAW, Drive ID = "c6d0"

Setup my pool called "laptop" (running as root)
zpool create laptop c6d0
Then we need a few folders on the drive just to make things nice. I am going to call it "freebie"
zfs create laptop/freebie
Now for some NFS magic
zfs set sharenfs=on laptop/freebie
Verify that the NFS share point is set properly
zfs get sharenfs laptop/freebie
Set the permissions for the folder so people can read and write to it. There are normal NIX commands
chmod 1777 /laptop/freebie
Also I want to locally go into the folder to modify the information through the GUI
zfs allow -u arthur create,mount laptop/freebie
Now you can test this by connecting. I am going to use a Mac for connecting, here is the command:
I dropped a few files and it transferred over to the folder. They were 616KB, 1.7MB, and 120KB, this is important for the next example which is to enable compression which I am going to turn on. If you don't want any compression then you can stop this demo.

Enabling compression is quite easy but I am not sure if existing files will compress but any new files will compress as they are added and removed. Enable Compression
zfs set compression=on laptop/freebie
Disable Compression
zfs set compression=off laptop/freebie
So I now the files are 608KB, 1.4MB, 38KB respectively, going to test larger files next. That is it for this demo. I have some other projects to work on including now setting up SMB to this folder as well or another folder.

No comments:

Post a Comment

Raspberry Pi Zero W - Wireless Configuation

create the file under "boot" folder wpa_supplicant.conf country=GB ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev u...