Posts

Showing posts from June, 2020

Adding ZVOL VIRTIO disks to a guest running on a host with the FreeBSD BHYVE hypervisor

On atlantis.domain (my FreeBSD BHYVE hypervisor host), I use these commands: Install FreeBSD on a 10G disk. vm create -s 10G guestname   vm install FreeBSD-12.1-RELEASE-amd64-memstick.img vm console guestname Add 8 30GB zvol-based disks vm add -d disk -t zvol -s 30G guestname vm add -d disk -t zvol -s 30G guestname vm add -d disk -t zvol -s 30G guestname vm add -d disk -t zvol -s 30G guestname vm add -d disk -t zvol -s 30G guestname vm add -d disk -t zvol -s 30G guestname vm add -d disk -t zvol -s 30G guestname vm add -d disk -t zvol -s 30G guestname You will need to do vm poweroff guestname vm start guestname because the guest does not seem to see the 8 30GB without power cycling. (rebooting won't work) *** If you want the boot disk (the one create by "vm create") to be a zvol, you must edit the template: root@atlantis:~ # zfs snapshot tank/vm-bhyve@2020-06-11-2145 root@atlantis:~ # mount -t zfs tank/vm-bhyve@2020-06-11-2145 /tank/vm-bhyve@2020-06-11-2145 r

Changing the capacity of each VDEV in a ZPOOL without losing data and no downtime with ZFS

Before we start, let's define some acronyms. FreeBSD: Free B erkeley S oftware D istribution ZFS: Z ettabyte F ile S ystem ZPOOL: Z FS POOL DEV: DEV ice VDEV: V irtual DEV ice GEOM: disk GEOM etry BHYVE: B SD HY per V isor ZVOL: Z FS VOL ume *** I have been tinkering with FreeBSD, ZFS, GEOM, BHYVE, and other interesting technologies. *** Let's experiment on how to change the capacity of each VDEV of a ZPOOL without losing data and no downtime with ZFS. To do so, you need a set of disks that are bigger. Example, if the ZPOOL has 2 mirror VDEVs with 2 10GB disks each (total: 4 10GB disks), and you want to upgrade to 20 GB disks, than you need 4 20GB disks for the upgrade. Figure 1: Live upgrade of disks in a ZPOOL ZPOOL tank                           ZPOOL tank     VDEV mirror-0                        VDEV mirror-0         DEV /dev/vtbd1                    DEV /dev/vtbd9         DEV /dev/vtbd2    --->          DEV /dev/vtbd10     VDEV mirror-1