Why isn't my ZFS pool expanding using ZFS on Linux?
Solution 1:
I'm running ZFS on Ubuntu 16.04 and after much trial and error, this is is what worked for expanding the disk and pool size without rebooting. My system is hosted in the cloud at Profitbricks and uses libvirt (not SCSI) drives.
Get pool and device details:
# zpool status -v
...
NAME STATE READ WRITE CKSUM
pool ONLINE 0 0 0
vdb ONLINE 0 0 0
# zpool list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
pool 39.8G 27.1G 12.7G - 49% 68% 1.00x ONLINE -
Activate autoexpand:
# zpool set autoexpand=on pool
Now login to Profitbricks control panel and increase disk size from 40GB to 50GB.
Notify system of disk size change and expand pool:
# partprobe
Warning: Not all of the space available to /dev/vdb appears to be used,
you can fix the GPT to use all of the space (an extra 10485760 blocks) or
continue with the current setting?
# zpool online -e pool vdb
# partprobe
# zpool list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
pool 49.8G 27.1G 21.7G - 40% 55% 1.00x ONLINE -
I'm not sure why, but it is sometimes necessary to run partprobe
and/or zpool online -e pool vdb
twice in order to make the changes effective.
Solution 2:
I read on the freebsd forums a post which suggested to use zpool online -e <pool> <vdev>
(without needing to offline the vdev first)
This ultimately was the solution, but it required that ZFS autoexpand be disabled first:
[root@timestandstill ~]# zpool list
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
dfbackup 214G 207G 7.49G 96% 1.00x ONLINE -
[root@timestandstill ~]# zpool get autoexpand
NAME PROPERTY VALUE SOURCE
dfbackup autoexpand on local
[root@timestandstill ~]# zpool set autoexpand=off dfbackup
[root@timestandstill ~]# zpool online -e dfbackup /dev/disk/by-id/virtio-sbs-XLPH83
[root@timestandstill ~]# zpool list
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
dfbackup 249G 207G 42.5G 82% 1.00x ONLINE -
Using zpool set autoexpand=off
followed by zpool online -e
was required to get the zpool to expand for me, using ZFS on linux (in kernel, not using FUSE)