With ZFS installed and enabled, we can now create the zpools. Zpool is the name given to volumes that are created within ZFS.
Since we will be using a single RAID 0 group consisting of four disks, we can create a zpool named brick1; this needs to be done on all three nodes. Additionally, let's create a directory named bricks that lives under the root (/); this directory houses the bricks under a directory with the brick name. The command required to do this is as follows:
mkdir -p /bricks/brick1
This creates the directory tree, as follows:
zpool create brick1 /dev/disk/by-id/scsi-360022480f0da979b536cde32a4a17406 \
/dev/disk/by-id/scsi-360022480fb9d18bbdfb9175fd3e0bbf2 \
/dev/disk/by-id/scsi-360022480fb9d18bbdfb9175fd3e0bae4 \
/dev/disk/by-id/scsi-360022480fb9d18bbdfb9175fd3e049f2
To further explain the command, brick1 is the name of the zpool. Then, we indicate the path to the disks. In this example, we are using the ID of the disks since this avoids problems if the disks change order. While ZFS is not affected for disks in a different order, it is better to avoid problems by using an ID that will never change.
With the zpool instance created, we can check whether it has completed correctly by using the zpool status command:
Let's enable compression and change the mount point of the pool to the previously created directory. To do this, run the following command:
zfs set compression=lz4 brick1
You will also need to run the following command:
zfs set mountpoint=/bricks/brick1 brick1
The first command enables compression with the lz4 algorithm, which has a low CPU overhead. The second command changes the mount point of the zpool. Make sure that you use the correct name of the pool when changing the settings.
After doing this, we should have the ZFS volume mounted under /bricks/brick1, as shown in the df command:
We need to create a directory on the recently added mount point to use as the brick; the consensus is to use the name of the volume. In this case, we'll name the volume gvol1, and simply create the directory:
mkdir -p /bricks/brick1/gvol1
This needs to be done on all the nodes.