Archive

Archive for the ‘ZFS’ Category

ZFS sharing over NFS

March 27th, 2009 Arthur Gressick 1 comment

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:

nfs://192.168.1.21:/laptop/freebie

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.

OpenSolaris ZFS setup

March 3rd, 2009 Arthur Gressick No comments

I will have a completed project called OpenSolaris NAS device once I get the testing finished but for now here are some directions for setting up a ZFS file system. I am using VMware fusion for Mac and created the main system and then 4 additional 1GB drives. I set them up at SATA drives which would be like I would have in the final product.

First thing I had to do what install the software and then after I install everything I opened the terminal and begin hacking away. Here are my commands that I ran:

Get the ID for each of the attached drives.

iostat -En

Create a simple mirror of just 2 drives. (drive_id = id from command above)

zpool create your_pool_name mirror drive_id drive_id

SAMPLE of script above

zpool create your_pool_name mirror c4t1d0 c4t2d0

Check your work

zpool list
zpool status

create a folder

zfs create your_pool_name/folder_name

Adding more space to the storage pool

zpool add your_pool_name mirror drive_id drive_id

Checking all of the drives that make up the zfs pool

zpool status -v

Setting reserve limits of space

zfs set reservation=157m your_pool_name/folder

Show any of the reservations on the system

zfs get reservation your_pool_name/folder

Remove a reservation from a folder

zfs set reservation=none your_pool_name/folder

Setting Quotas

zfs set quota=3M your_pool_name/folder

Show Quotas

zfs get quota your_pool_name/folder

Removing the Quote

zfs set quota=none your_pool_name/folder

Changing Permissions (I am sure there is a ZFS one, I used Unix)

chown user:group /your_pool_name

Always check the pool to see if it is already compressed

zfs get compression your_pool_name/folder

Start compression

zfs set compression=on your_pool_name/folder

Turn off compresstion

zfs set compression=off your_pool_name/folder

Look for more articles on ZFS.