[SOLVED] Resize ZFS for swap


Well-Known Member
Apr 11, 2019

i need some space for swapping, and following this guide it should be better outside the ZFS Raid1 (2 disks):

What i was thinking of is to:
- remove one disk from the pool
- create 2 partitions on the removed disks (ZFS & swap)
- create a new pool on the first partition
- migrate drives from the old pool to the new pool
- tell Proxmox to boot from the new pool
- remove the old pool
- add the disk from the old pool to the new pool as raid member

This is just prototyping, i dont know if this a feasible at all, thats why i want to ask some more experienced memebrs here if this is feasible at all - or if there is even a better approach.

Thank you
it should be better outside the ZFS Raid1

There is no need to destroy and recreate a pool.

In this process you lose redundancy temporary. To avoid this you may simply work with a third disk if possible. In any case: make a Backup first ;-)

This is from my mind, not tested in this very moment. I'd done this a few week ago as I had to replace a mirrored vdev with smaller SSDs - which does not work inplace. Note that removing a top level vdev does work now, some years ago it was simply impossible. See man zpool-remove for details and for confirmation.
  • remove one disk, the official way = not simply unplugging (not sure without testing: "zpool detach" or "zpool remove")
  • prepare partition table as desired
  • add the newly specified as a new vdev to the only pool. Note that this usually is not recommended - except in your specific case
  • remove the old top level vdev - this will "free" the other disk
  • partition that second disk
  • attach it to the other partition to recreate the mirror
Note also that you did not have to move data by a specific command. It does happen as part of removing the old top level vdev, so be patient.

Good luck
Thank you for your fint, but it doesnt work. The re-attached disk is for obvious reasons now smaller and cant be attached:
"cannot attach ata--part4 to nvme-part3: device is too small"
I guess i will now create a fresh pool on the resized disk and move everything around?! Or is there somne other way?
The actual data is way smaller then the disks size
Okay. At the end it is: do it the way you are comfortable with.

My recipe said (in a crippled sentence) "add the newly specified as a new vdev" and what I meant was that you can always add a new vdev in whatever size - and this is usually not what you want to do. Your attempt to "attach" it to an already existing member is another thing. This would create a mirror and the attached device needs be at least the same size.

Your approach with a new pool is cleaner and easier, so... have fun! :)


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!