meta data for this page
  •  

This is an old revision of the document!


ZFS shrink pool

Shrink 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 not ''add'
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

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