How to add new disk to ZFS pool?

Old thread but can anders's attach be done with a drive of a smaller size?

I have a ZFS mirror pool of 2, 1TB HDD drives and I want to gradually move boot onto 256GB SSD's. I understand this will probably come with a boot storage downgrade to 256G.
As so often: it depends.
  • no, you can not add a smaller device as a mirror to an already present disk
  • yes, you can add new disks of any size to a pool - creating a new vdev - what is often NOT what you want
You have a pool consisting of a single mirror with two 1 TB disk. Now you want to replace this mirror with two SSDs.

Yes, you can actually do it this way: add the two SSD as an additional mirror to the pool - temporarily. Now you have a "striped mirror", similar to a "Raid10".

Now you can remove the old HDDs from the pool. (Do not just unplug them!) Removing might take some time, be patient. The remainder consist only of the new SSDs. Details are here: man zpool-remove


Be careful, there might be dragons! While I am for sure firm with ZFS I would really test the procedure in a testbed before I do it in production.
 
Bump. I need to add a second datadisk to PBS (not PVE) as a mirrored device. Here is the current setup with the single 2TB datadisk (sdb)

root@hp-srv08:~# lsblk -fp
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
/dev/sda
├─/dev/sda1
├─/dev/sda2 vfat FAT32 0DA9-2554 1013.2M 1% /boot/efi
└─/dev/sda3 LVM2_member LVM2 001 arV0dK-yrom-71r6-H0Il-GfcA-AjPD-s96iMQ
├─/dev/mapper/pbs-swap swap 1 8310221d-37cc-4942-b895-c35da55b8e33 [SWAP]
└─/dev/mapper/pbs-root ext4 1.0 bb049d84-911b-4533-b458-6e75e33a594c 389.1G 1% /
/dev/sdb
├─/dev/sdb1 zfs_member 5000 HP-BACKUP 8336655535497608317
└─/dev/sdb9

root@hp-srv08:~# zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
HP-BACKUP 1.81T 581G 1.25T - - 35% 31% 1.00x ONLINE -

root@hp-srv08:~# zfs list
NAME USED AVAIL REFER MOUNTPOINT
HP-BACKUP 581G 1.19T 580G /mnt/datastore/HP-BACKUP
root@hp-srv08:~# mount | grep HP
HP-BACKUP on /mnt/datastore/HP-BACKUP type zfs (rw,relatime,xattr,noacl,casesensitive)

The new disk will most likely be named /dev/sdc, and from what I understand I should be fine with the following commands

# zpool attach HP-BACKUP /dev/sdb /dev/sdc

Is it really as simple as this?
 
Is it really as simple as this?
Yes.

Nothing new:
  • if the new disk has a different (larger!) size you may need to "force" it
  • I do recommend to use the names listed in /dev/disk/by-id instead - you know... sda/sdb/sdc may not be as stable as hoped
  • and I would erase the added disk in beforehand, that's not really required but it is cleaner; the cleanest way is to have no partition table at all - then ZFS will create its own partition schema
  • you may read man zpool-attach
Good luck :-)

PS: please use [code]...[/code] tags to paste terminal output. You may use the "</>" -Symbol for this.
 
Last edited:
Thank you for confirming. Both disks will be 2TB.

I take it that
Code:
sgdisk --zap-all /dev/sdX
will be sufficient for clearing all disk structures before attaching it to the zfs pool?

I will read the man page to get a better understanding of the process.
 
  • Like
Reactions: UdoB