Solved Increase zpool of VM

Hello,
I want to increase the size of zpool of a FreeBSD 11.2 VM on VMware. My zpool is created directly on /dev/da1
Usually I increase the disk size on hypervisor level, then I check that 'autoexpand' property is 'on', then I do 'zpool export poolname' and 'zpool import poolname' and next I can do 'zpool online -e tanktest /dev/da2' to increase the volume. This procedure works well, but there is a small problem - I must unmount all zfs volumes of the zpool to be able to export the zpool. And I need to export/import the zpool to refresh the free space on the device. Sometimes it is difficult to do as I must stop all jails and applications using the volumes.
Is there a better way to force zfs refresh the available device space?

PS
I know that I can just create another device and hot add it to zpool, but I want to stay with one zpool device.
 
Yep, no need to export/import, a zpool online should be enough.
 
Hmm...
There is nothing in EXPANDSZ column of output of zpool list before export/import, so zpool online does not work...
 
I did this recently with physical disks, and had no problem expanding the vdev. If you're having issues and not seeing anything in the EXPANDSZ column, I suspect you're using GPT/MBR and handing a partition to the zpool and not the whole disk.

I'm not sure how to fix this but presumably some gpart(8) command will let you expand the patition.

Edit: Whoops, forgot you said it was created directly on the device, in which case I'm not sure why it's not working.

Are you trying to increase the size of the disks without restarting the VM? I think that would require some sort of hot swap disconnection/reconnection of the device (for cam to get the new size of the disk), followed by a resilver, but I've never run ZFS within a VM so I'm not sure.
 
Are you trying to increase the size of the disks without restarting the VM? I think that would require some sort of hot swap disconnection/reconnection of the device (for cam to get the new size of the disk), followed by a resilver, but I've never run ZFS within a VM so I'm not sure.
Yes, I'm trying to increase the size without VM restart.
Sure, export/import zpool works, but I have no idea about another sort of hot swap of the device. The idea is to increase the size without shutting down jails, hosted on the zpool.
 
I'll try it as soon as I can.
More things to try:
The command camcontrol readcap da1 -h will read the capacity directly from the device, bypassing what the kernel thinks the device size is. If that command displays the correct size (i.e. the new, larger size), then camcontrol reprobe da1 should update the kernel's idea of the device size. Then the above-mentioned zpool online command should work.
 
Does diskinfo -v /dev/da1 report the correct size of the device?
No, it shows the old size.
More things to try:
The command camcontrol readcap da1 -h will read the capacity directly from the device, bypassing what the kernel thinks the device size is. If that command displays the correct size (i.e. the new, larger size), then camcontrol reprobe da1 should update the kernel's idea of the device size. Then the above-mentioned zpool online command should work.
camcontrol readcap da1 -h shows correct (new) size.
After camcontrol reprobe da1 - diskinfo -v /dev/da1 shows the new size as well.
But EXPANDSZ column of output of zpool list is still blank, so expanding the zpool does not work :(
I think that it is necessary to tell to zfs that the size was changed, but I don't know how...
 
And finally - it works!
camcontrol reprobe da1 does not change EXPANDSZ parameter of the pool, BUT zpool online -e pool /dev/da1 works as expected!!
The situation is a little bit strange for me as all the docs mention that to be able to expand the pool one should see EXPANDSZ positif...
Thanks a lot, olli@!!
 
Back
Top