Recently, I found out that the ZFS pool on a FreeBSD is running out of space. There is no option to clean up this storage, but there are spare disks. So the next logical thing to do is to add 2 extra disks to the existing (mirror) ZFS pool.
This FreeBSD server is a virtual machine (VM), and after attaching 2 physical disks to this VM, I had difficulty identifying these disks. Well, I could guess it, but this is a production server, and I really don’t want to spend my whole weekend to setup this server from the backup. :)
On FreeBSD, we can run geom disk list
to list all disks attached to the system. So let’s try this out.
root@freebsd1:~ # geom disk list | grep -E '(Name|Mediasize)'
1. Name: vtbd0
Mediasize: 21474836480 (20G)
1. Name: vtbd1
Mediasize: 6001175126016 (5.5T)
1. Name: vtbd2
Mediasize: 6001175126016 (5.5T)
1. Name: vtbd3
Mediasize: 6001175126016 (5.5T)
1. Name: vtbd4
Mediasize: 6001175126016 (5.5T)
1. Name: vtbd5
Mediasize: 6001175126016 (5.5T)
1. Name: vtbd6
Mediasize: 6001175126016 (5.5T)
1. Name: vtbd7
Mediasize: 6001175126016 (5.5T)
1. Name: vtbd8
Mediasize: 6001175126016 (5.5T)
1. Name: cd0
Mediasize: 0 (0B)
From the above list, there are 8 x 5.5T drives. Six of those drives are currently in use as the ZFS pool. This can be checked by running zpool status [ZPOOL_NAME]
.
root@freebsd1:~ # zpool status vault
pool: vault
state: ONLINE
scan: scrub repaired 0 in 0 days 09:57:17 with 0 errors on Sun Feb 28 07:46:48 2021
config:
NAME STATE READ WRITE CKSUM
vault ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
vtbd1 ONLINE 0 0 0
vtbd2 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
vtbd3 ONLINE 0 0 0
vtbd4 ONLINE 0 0 0
mirror-2 ONLINE 0 0 0
vtbd5 ONLINE 0 0 0
vtbd6 ONLINE 0 0 0
If we look carefully, we can guess that vtbd1, vtbd2,…,vtbd6 are the 6 disks in use out of the 8 listed earlier. But, do we know for sure? Should we just assume that this is the case? Well, I don’t know about you, but I rather have something to backup my guess. Plus, it gives me an excuse to write this blog post.
So a few commands I would use to interrogation a Linux system for information related to disks are: udiskctl
, blkid
, lsblk
, dmesg
,…etc. Apart from dmesg
, other commands weren’t available, and I’d thought that they couldn’t be installed on FreeBSD. dmesg
didn’t give me any useful information I was looking for either.
Then I went back to Google search, and this time I hit a jack pot. There is actually lsblk
command on FreeBSD provided by a package called, you guess it, lsblk.
Let’s install lsblk package.
root@freebsd1:~ # pkg install lsblk
After this, I can run lsblk
to list all block devices.
root@freebsd1:~ # lsblk
DEVICE MAJ:MIN SIZE TYPE LABEL MOUNT
...
vtbd1 0:64 5.5T zfs - -
vtbd2 0:65 5.5T zfs - -
vtbd3 0:66 5.5T zfs - -
vtbd4 0:67 5.5T zfs - -
vtbd5 0:68 5.5T zfs - -
vtbd6 0:69 5.5T zfs - -
vtbd7 0:70 5.5T - - -
vtbd8 0:71 5.5T - - -
Now, I can be sure that the two new disks attached to this server are: vtbd7 and vtbd8.
There a few other ways to list block devices on FreeBSD. You can read more at the following link: