How to remove drive from pool without data loss?

Cheese_Echidna

Dabbler
Joined
Jan 16, 2022
Messages
13
Hi,
I'm trying to remove one of the drives from a pool that is striped across two drives (I know this is dangerous and can lead to data loss). The total amount of data stored is less than the capacity of the drive that is not going to be removed so it should fit, however, I don't know how to tell TrueNAS that I want to eject the drive.
I am a hobbyist who is fairly new to servers in general and the only reason that I have a pool striped across two drives is because I was hitting the capacity of my first drive, but that has been remedied. The problem is that the old PC that I am using to run TrueNAS only has 3 SATA ports, so with one for the boot drive, there is only capacity for two data drives. I will be purchasing a larger drive to replace the one being taken out, and would also appreciate some advice on how best to add this new drive in a way that is less dangerous, but I would really rather not have to deal with two pools.
Thanks
 

ChrisRJ

Wizard
Joined
Oct 23, 2020
Messages
1,919
You will need to backup your data to some other place, re-create the pool, and restore the data.
Edit: I stand corrected as below. Thanks, @sretalla
 
Last edited:

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
There is/has been the zpool remove command which can do that for some time now... it can operate on a pool that has no RAIDZ VDEVs in it, so stripe and mirrors are OK to use with it.

So for a pool tank with a disk you want removed called gptid/abc-xyz-etc (you need to identify it properly from zpool status tank, maybe using glabel status | grep da2 or whatever to help if needed):
zpool remove tank gptid/abc-xyz-etc

That will do a copy operation of all the blocks on the disk to be removed to the remaining disk(s) in the pool and release the disk. It may take some time if you have a lot of data, so check the status with zpool status -v tank before you actually pull the disk out, you're looking for something like this:

Code:
  pool: tank
 state: ONLINE
remove: Removal of vdev 0 copied 64.5K in 0h0m, completed on Fri Feb  4 10:29:45 2022
    240 memory used for removed device mappings


Good luck with it.
 
Top