Overview
There are lots of ways to manage your ZFS pools. This article contains some useful commands and examples. They are suitable for any kind of virtual device configuration including mirrored, RAIDZ or nonredundant.
Status
Check the health of all pools.
sudo zpool list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
DUMPSTER 10.9T 1.45T 9.43T - 0% 13% 1.00x ONLINE -
Check the health of a specific pool.
sudo zpool status DUMPSTER
pool: DUMPSTER
state: ONLINE
scan: resilvered 235G in 2h10m with 0 errors on Sun Apr 5 15:26:31 2020
config:
NAME STATE READ WRITE CKSUM
DUMPSTER ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
sdb ONLINE 0 0 0
sdc ONLINE 0 0 0
sdd ONLINE 0 0 0
sde ONLINE 0 0 0
sdf ONLINE 0 0 0
sdg ONLINE 0 0 0
errors: No known data errors
Permissions
Check permissions
ls -ld /DUMPSTER
drwxr-xr-x 2 root root 2 Mar 23 08:49 /DUMPSTER
By default, the mount point of your ZFS pool is only writable by root.
Change permissions
Set the user and group on the mount point of our pool.
sudo chown -Rfv myusername:mygroupname /DUMPSTER
changed ownership of '/DUMPSTER' from root:root to myusername:mygroupname
Mount point
Check mount point
df -h | grep DUMPSTER
DUMPSTER 5.2T 128K 5.2T 1% /DUMPSTER
The default mount point for a ZFS pool is /mypool
.
Change mount point
sudo zfs set mountpoint=/var/storage DUMPSTER
You can set the mount point to any location. If the directory doesn't already exisit then you should create it first.
Destroy
All data in the pool will be lost!
If the pool contains important data, then back-up that data before proceeding.
sudo zpool destroy DUMPSTER
Rename
There is no rename command. However, we can rename a pool by exporting it, then importing it with a new name.
sudo zpool export DUMPSTER
Now we can import the same pool whilst applying a new name.
sudo zpool import DUMPSTER TRUCK
Check that the renaming has been successful.
sudo zpool list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
TRUCK 10.9T 1.45T 9.43T - 0% 13% 1.00x ONLINE -
Share
Share using Samba
Samba, using the SMB protocol, allows you to share your ZFS pool with other clients.
First we need to install Samba.
sudo apt-get update
sudo apt install samba
Then turn on Samba sharing for our ZFS pool.
sudo zfs set sharesmb=on DUMPSTER
This will create a file within /var/lib/samba/usershares called yourpool, in this case DUMPSTER.
Make sure you add your user to the Samba database
sudo smbpasswd -a dave
Please read how to create a Samba network share for more information.