meta data for this page
ZFS: resize zpool
extend pool
Get device name used in pool:
zpool status nvmpool
# resize /dev/nvme0n1p3 parted /dev/nvme0n1
resizepart 3 End ? [X.XGB]? quit
zpool online -e nvmpool nvme0n1p3
ZFS: shrink zpool
Shrinking of zpool is not possible, but trick with 2nd device (or even file) works:
- add 2nd device to zpool (can be smaller - only to fit data)
- remove 1st device - zpool will copy all data to another device.
- to create mirror, use
attach
notadd
zpool list rpool -v zpool offline rpool /dev/disk/by-id/SECOND-part3 zpool detach rpool /dev/disk/by-id/SECOND-part3
Resize /dev/disk/by-id/SECOND-part3
to smaller size.
zpool add rpool /dev/disk/by-id/SECOND-part3 zpool remove rpool /dev/disk/by-id/FIRST-part3
Sometimes ZFS refuse to remove device with 'out of space' error (but second device is capable to handle all data). To solve it, add more temporary devices to rpool
zfs create -V 64gb nvmpool/t1 zfs create -V 64gb nvmpool/t2 zpool add rpool /dev/zvol/nvmpool/t1 zpool add rpool /dev/zvol/nvmpool/t2
Resize /dev/disk/by-id/FIRST-part3
to smaller but equal to SECOND-part3 size.
zpool attach rpool /dev/disk/by-id/SECOND-part3 /dev/disk/by-id/FIRST-part3
zpool attach rpool /dev/dusk/by-id existing disk