This is my current pool configuration:
root@ubuntuzfs:~# zpool status tank
scan: scrub repaired 0B in 13:19:59 with 0 errors on Mon Oct 16 21:20:01 2023
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
wwn-0x50014ee2664cd53e ONLINE 0 0 0
wwn-0x50014ee2649ac8b8 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
wwn-0x50014ee212d29757 ONLINE 0 0 0
wwn-0x5000c500f1e4b1eb ONLINE 0 0 0
errors: No known data errors
Unfortunately I did not discover the incompatibility of SMR drives with zfs until after I created the pool.
Now I want to convert this pool to a two drive mirrored pool with SSD’s.
The existing HDD’s are 2GB each. The SSD’s are 8GB.
zfs replace tank wwn-0x50014ee2649ac8b8 [the SSD]
zfs replace tank wwn-0x50014ee2664cd53e [the SSD]
zpool remove tank mirror wwn-0x50014ee212d29757 wwn-0x5000c500f1e4b1eb
Will that remove the mirror and convert the pool to a single mirror pool?
Yes, since you’re using mirrors, you can (assuming ashift matches on all vdevs) remove one mirror vdev after replacing both disks in one of the mirrors with your SSDs.
However, if you’ve already got a lot of data, I wouldn’t recommend doing that. When you remove a vdev, ZFS doesn’t just move the data cleanly onto other vdevs… it moves the data, but also has to create redirect metadata for the evacuated blocks. So, essentially, your system has to do double metadata reads for the relocated blocks.
For that reason, if you’ve got much data on this system already, I’d recommend just creating a new pool and replicating your data onto the new pool.
You’ve got the first steps exactly right.
but I don’t think it’s possible to remove a VDEV from a pool, so you’ll have to replace those two disks as well.
The alternative, which seems much quicker to me is:
- make a new pool with the SSDs (call it tank2 or something),
zfs send | zfs recv your data to the new pool,
- export the tank pool, export the tank2 pool,
zpool import tank2 tank.
That last part will rename the new pool using the original name, so any services you had tied to it will work as expected.
Edit: Turns out you can remove a vdev from a pool of mirrors. You learn something new everyday.