Adding a hotspare to a pool: can I remove it afterwards?

Due to a series of unfortunate events, I purchased 2 16TB HDDs and discovered I don’t need them anymore (the HDDs that were meant for replacement are not actually broken).

I don’t want these HDDs to go bad, so my thought was to put them as hot spare of other pools.

I have 2 pools, each pool is made in the following way:’

1 pool of 1 vdev. The vdev is a mirror (2 disks set up as a mirror vdev).

When trying to add a hot spare, it looks like I have to add another vdev to the pool and set this vdev as hotspare.

If I want to later remove the hotspare because maybe the pool is on it’s fine and a different pool breaks, will the hotspare vdev cause problems? I remember that removing a vdev from a pool usually breaks stuff.

I have no experience with more than 1 vdev, so I’m not sure about the consequence of this operation. All I want is my HDDs to spint and minimize their hardware “consumption” but prevent them to die by being on a shelf.

You can remove spares after they are added, yes. It’s not an issue.

1 Like

And pools can share hot-spares.

Of course, whence a hot-spare is needed, it becomes tied to the pool needing it. It becomes free again after the failed disk has been replaced.

Note that you can cause a hot spare to permanently replace a failed disk, if that is desired.

Last, sharing hot spares prevents one pool from being exported independent from the other.

3 Likes

Even if the hot spare is not currently being used by any pool?

Good point, I looked it up in the manual page for “zpoolconcepts”;

   If  a  pool  has a shared spare that is currently being used, the pool cannot be exported, since other pools
   may use this shared spare, which may lead to potential data corruption.

That implies that a pool can be exported with shared hot spare that is not in use.

1 Like

This is exactly what I want. I tried to do this through the UI on TrueNAS core, but I can’t seem to be able to use the same disk for multiple vdevs and I can’t figure out how to assign the “hot spare” vdev to multiple pools

The GUI does not always expose all the features of ZFS.

It also helps to use the right terminology. This wording;

but I can’t seem to be able to use the same disk for multiple vdevs

Should probably be written;

but I can’t seem to be able to use the same disk for multiple pools

1 Like

I see, I might stick to just one hotspare per pool. I have 3 mirrors on one pool, and 2 other pools and 2 spares, so I can just have 1 hot spare for the other pool.

Thank you!