0

I have Linux PC with RaidZ2 over 6 disks, 3T each. Disks is shared between several partitions; the zpool lays only on part 6 on each disk; other partitions are used for other purposes.

I am going to buy 6x4T.

My plan is to:

  • boot a live CD that is not aware of ZFS
  • copy each 3T disk onto a 4T disk
  • create on each 4T disk a new partition n° 18
  • reboot my normal system
  • expand my zpool over all partitions 18

Will it work ? what's the command to expand the pool with a set of 6 partitions sda18...sdf18 ?

If its not possible, I have a fallback method I don't like: make partitions 18 as large as possible (probably 1T), dump sd[abcdef]6 into sd[abcdef]18, erase sd[abcdef]6, and then, ask the zpool to expand in a partition larger than it used to be.

Thanks

1 Answer 1

1

After cloning the 3T drives to 4T drives, don't add new partitions, just resize the existing ZFS partitions.

There's nothing stopping you from adding partitions as you plan but if you do so, performance will be abysmal because zfs would waste an enormous amount of time moving the disk heads back and forth from the middle of the drive (the existing sd[a-f]6 partitions) to the end of the drive (the new sd[a-f]18 partitions). You'd have a pool that was effectively a raid-0 of two raidz6 vdevs, instead of just one raidz6 vdev.

If there are other partitions on the disks after your ZFS partitions, then move them to the end of the drive to make space for the ZFS partitions to grow, then expand the zfs partitions. Rebooting to a Live CD or USB etc with gparted (e.g. a rescue CD/USB like gparted) would be good for this.

Alternatively, move the ZFS partitions to just after the other partitions, and then move the other partitions to where ZFS used to be, and then move the ZFS partitions again and then, finally, resize the ZFS partitions. This is a lot more work, will take a lot more time (all downtime!), and will probably rename/renumber all the moved partitions, so you'll need to update your configs where relevant. The only real benefit would be that it would be easier to expand the zfs partitions again in future, if you get bigger drives.

After rebooting, you can use zpool offline pool partition followed by zpool online -e pool partition for each partition to expand the pool to use all available space.

IMPORTANT: perform both commands on ONE partition at a time. Do not offline more than one partition simultaneously. e.g.

for p in sd[abcdef]6; do
  zpool offline pool "$p"
  zpool online -e pool "$p"
done

From man zpool-online:

-e Expand the device to use all available space. If the device is part of a mirror or raidz then all devices must be expanded before the new space will become available to the pool.

Actually, that quoted text isn't complete. It should say something like "If the device is part of a mirror or raidz vdev then all devices in that vdev must be expanded before the new space will become available to the pool."

i.e. if you have a pool with multiple vdevs (e.g. multiple mirror vdevs and/or multiple raidz vdevs) then the vdevs can/will be expanded individually.

12
  • But PLEASE, don't use /dev/sd? device names. Create GPT partition labels and use those. Since the OP is replacing every device on the VDEV, now is the perfect time to rectify past oversights.
    – Jim L.
    Dec 6, 2021 at 5:54
  • 1
    personally, I use /dev/disk/by-id/ device names because I like to see the device brands, models, and serial numbers in zpool status (makes it easy for me to identify which drive needs to be pulled in case of failure). But the OP is already using /dev/sd*, and this Q&A isn't about the pros and cons of zpool device naming choices.
    – cas
    Dec 6, 2021 at 5:57
  • Yes, labeling partitions based on drive SN is the current best practice, to my knowledge. A human-readable identifier is paramount.
    – Jim L.
    Dec 6, 2021 at 6:07
  • Understood about the pros and cons but also important is identifying opportunities for redemption of past transgressions. ;)
    – Jim L.
    Dec 6, 2021 at 6:14
  • How much time and reads will offline+online-e take ? is it going to be a quick command in seconds, or, will resilvering take hours after each online-e ? I agree that /dev/disk/by-id/ is technically better, but as said, this topic was about raidz expansion, not namespaces, so sd[abcdef]* was faster to type and lighter to read. My disks technically have 20 partitions each; I have designed my mdadm block and splitted it in reverse ordered partitions, with last part of mdadm just after ZFS, so that a simple shrink of mdadm would allow to expand zfs keeping zfs in one block. Thanks CAS. Dec 7, 2021 at 8:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .