lsblk -S # General Linux command
geom disk list # FreeNAS specificzpool listzpool clearzpool create -f files /dev/sdb /dev/sdc /dev/sddOptional Parameters
- -m mountpoint
Sets the mount point for the root dataset. The default is/pooloraltroot/poolif altroot is specified. The mount point must be an absolute path, legacy, or none.
For more information, see thezfs(8)man page.
zpool create files mirror /dev/sda /dev/sdbNote: Use
raidzinstead ofmirrorfor RAID 5 setups.
zfs set mountpoint=$NEWPATH $POOLzpool destroy $POOLZFS file systems live 'inside' pools. By default, they are mounted under the parent pool.
For example:
zfs get mountpoint bigNAME PROPERTY VALUE SOURCE
big mountpoint /var/lib/snapd/hostfs/big local
To create a filesystem:
zfs create big/docker # docker is a filesystem inside the pool named bigzfs get mountpoint big/dockerNAME PROPERTY VALUE SOURCE
big/docker mountpoint /var/lib/snapd/hostfs/big/docker inherited from big
As you can see, big is mounted in /var/lib/snapd/hostfs/big, and big/docker is mounted in /var/lib/snapd/hostfs/big/docker.
zfs set mountpoint=/var/lib/docker big/docker
zfs get mountpoint big/dockerzfs listshows all file systemszfs list -r smallshows all file systems undersmallzfs list -t snapshotshows all snapshots
Snapshots capture a point in time of a file system. Snapshots can't be accessed directly, but you can clone them, back them up, and roll back to them.
zfs snapshot big/test@demoList snapshots:
zfs list -t snapshotExample output:
NAME USED AVAIL REFER MOUNTPOINT
big/test@demo 0B - 96K -
After making changes (e.g., creating a file):
touch /home/user/test/afile.txt
ls /home/user/test/
afile.txtRollback to the snapshot:
zfs rollback big/test@demo
ls /home/user/test/<nothing is shown>
You can make a copy of a snapshot into a new filesystem.
Here we take the snapshot big/test@demo and create a new ZFS filesystem big/demobackup from it:
zfs clone big/test@demo big/demobackupNote: Snapshots used to create cloned file systems can't be deleted until the cloned file system is destroyed.
You can also send your snapshot to another machine.
Here we're sending the big/test@demo snapshot to othermachine into the backup/test filesystem:
zfs send big/test@demo | ssh othermachine zfs recv backup/testThe receiving machine (othermachine) must have ZFS installed.