This is a set of notes for common ZFS command and operations.
ZFS is an advanced file system that enabled snapshot, checksum and soft-raid features. Wiki on ZFS
A good set of ZFS reference can be found below: ZFS admin intro
List all paritions:
lsblk
Show details of the disks:
sudo lshw -class disk
The follow would create a mirror (think raid 0) across two devices.
sudo zpool create tank mirror sdd sde
Instead of directly using the created pool, it is usual to build a couple of datasets on top of the pool. To create a dataset,
zfs create tank/test
zfs set compression=lz4 tank/log
zfs set mountpoint=/mnt/test tank/test
zfs mount tank/test
We also enable the compression of the dataset via set compression.
Setup nfs under Ubuntu:
sudo aptitude install -R nfs-kernel-server
echo '/mnt localhost(ro)' >> /etc/exports
sudo /etc/init.d/nfs-kernel-server start
Share nfs:
zfs set sharenfs="rw=@10.80.86.0/24" pool/srv
zfs set sharenfs="on" pool/srv
Scrubing check the data integrity:
zpool scrub tank
Consider adding above to a cron-job. A set of script can be found here: ZFS scrub and status scripts