Image: Canonical

If you read my piece, How to use ZFS in Ubuntu 19.10, you know that ZFS support is now an option. You also read how to create, roll back, and delete snapshots. However, there’s more you can do with ZFS.

One thing you should understand how to do is the management of your ZFS Pools. ZFS is capable of managing data that spans across devices. ZFS uses virtual storage pools, called zpools. A zpool can contain numerous directories. For example, on a Ubuntu Desktop 19.10 installation (with ZFS support added), there are two basic pools:

  • bpool is the boot pool and stores all boot-related directores
  • rpool is the root pool and stores everything under / (minus /boot)

Both of these pools (on my desktop instance) are on the same drive.

To list out these pools, issue the command:

zfs list

SEE: 10 free alternatives to Microsoft Word and Excel (TechRepublic download)

How to check the status of a pool

One of the first things you might want to do is check the status of your pools. To do that, issue the command:

sudo zpool status

As you can see (in Figure A), the command will report back to you plenty of information about your pools.

Figure A

How to update a pool

Effectively, the error we are seeing is because ZFS has been upgraded and new feature flags added. However, the bpool zpool is out of date. In order to solve this error, we must update the pool which will add the new feature flags. Prior to doing this, I highly recommend taking a snapshot or doing a full backup of the system in case something goes wrong and your system is rendered unbootable. To run the pool upgrade, issue the command:

sudo zpool upgrade POOL

Where POOL is the name of the pool to be upgraded (in our case bpool). Once the command completes, you should see that the new feature flags have been added (Figure B).

Figure B

Author’s note: I was contacted by one of the ZFS maintainers who warned that upgrading the bpool zpool could break booting of the system. Although I tested this with no problems, I feel compelled to point out this warning.

According to the developer, the bpool pool intentionally uses an out of date version, as GRUB does not support all of the zpool features. Because of this, I would recommend you not upgrading the bpool pool. All other pools, however, should be fair game.

How to add drives to pools

What if you add a new drive to a system and that drive needs to become part of a pool? This is actually quite easy. After formatting the drive with the ZFS filesystem type and attaching it to the system, you can then add it to the pool with the command:

sudo zpool add POOL /dev/sdX

Where POOL is the name of the pool the drive is to be added to and X is the letter name of the drive.

Note: This is not how you add a device to a zpool mirror (we’ll deal with that at another time, as there are considerably more steps involved).

How to view events

Finally, the zpool command includes the events option. This option comes in handy when there’s a drive within a pool that you suspect is having issues. Although the events option is very poorly documented, it’s still a good place to start when you’re experiencing trouble. To view the events of a particular pool, issue the command:

sudo zpool events POOL

Where POOL is the name of the pool in question.

This will generate a listing of all events that have occurred since your ZFS system was put in place (Figure C).

Figure C

For even more information, add the -v flag like so:

sudo zpool events POOL -v

Where POOL is the name of the pool in question. This will include the likes of pool_guid, pool_state, pool_context, and more (Figure D).

Figure D

And that’s the basics of managing ZFS pools in Ubuntu Linux 19.10. As I mentioned earlier, we’ll be digging into managing mirror pools at a later date. Until then, give the zpool man page a read with the command man zpool.