ZFS on FreeBSD
Partitioning GEOM class by gpart
Before using ZFS, we have to configure the disk partitioning. In order to configure the disk partitioning, we can use gpart. First, we create GUID partition table (GPT) on your blank (new) disk (/dev/daX) by the following command.
# gpart create -s GPT daX
After creating GPT, we can check the current disk partitioning of daX like this:
# gpart show daX =< 34 13673828285 daX GPT (6.4T) 34 13673828285 - free - (6.4T)
Second, we add new partition to the disk for ZFS type. The next command is to use the entire disk space as one ZFS partition when the disk daX is the one shown above (i.e., the partition begins on the logical block address 34 and its size is 13673828285 in logical block numbers).
# gpart add -b 34 -s 13673828285 -t freebsd-zfs daX
Creating ZFS storage pool by zpool
After configuring the disk partitioning, we can create a spool for ZFS by the following command.
# zpool create pool /dev/daXp1
Here, we note that you can change the name of pool expressed as pool in the command into your preferred name, and p1 in the device name (/dev/daXp1) means the first partition.
We then create a ZFS file system on your ZFS pool.
# zfs create pool/fsname
Here, pool is your pool name and fsname is your preferred name.
We can check the current file system information by list subcommand:
# zfs list NAME USED AVAIL REFER MOUNTPOINT pool 95.5K 6.21T 19K /pool pool/fsname 18K 6.21T 18K /pool/fsname
Mounting your file system
All file systems are mounted by mount subcommand of zfs command with -a option to the corresponding mount points that can be checked by list subcommand of zfs command:
# zfs mount -a