meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:fs:zfs:shrink [2021/11/30 11:20] niziaklinux:fs:zfs:shrink [2024/02/16 07:49] (current) niziak
Line 1: Line 1:
-====== ZFS shrink pool ======+====== ZFS: resize zpool ======
  
-Shrink zpool is not possible, but trick with 2nd device (or even file) works:+===== extend pool ===== 
 + 
 +Get device name used in pool: 
 +<code bash> 
 +zpool status nvmpool 
 +</code> 
 + 
 +<code bash> 
 +# resize /dev/nvme0n1p3 
 +parted /dev/nvme0n1 
 +</code> 
 + 
 +<code> 
 +resizepart 3 
 +End ? [X.XGB]? 
 +quit 
 +</code> 
 + 
 +<code bash> 
 +zpool online -e nvmpool nvme0n1p3 
 +</code> 
 + 
 +====== 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)   * add 2nd device to zpool (can be smaller - only to fit data)
   * remove 1st device - zpool will copy all data to another device.   * remove 1st device - zpool will copy all data to another device.
Line 18: Line 42:
 zpool add rpool /dev/disk/by-id/SECOND-part3 zpool add rpool /dev/disk/by-id/SECOND-part3
 zpool remove rpool /dev/disk/by-id/FIRST-part3 zpool remove rpool /dev/disk/by-id/FIRST-part3
 +</code>
 +
 +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''
 +<code bash>
 +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
 </code> </code>