Converting Single Disk to RAIDZ

ryandasilva

Dabbler
Joined
Jun 12, 2021
Messages
27
So i have a single 4tb disk pool. I have added 2 additional 4tb disks to my system. There is lots of data on the pool so I'd prefer not to have to blow it all away. If blowing it all away and re-creating from scratch is my only option then I will have to run an off schedule backup, blow away, recreate, and restore from cloud backup which wouldnt be the worst thing in terms of testing in a real world, but not disaster scenario, to make sure my backup/restore process actually works. But i am hoping there is some easier way thru the CLI (or web UI) to turn a single disk pool into a 3 disk RAIDZ. Anyone know if/how this can be done?

Thanks in advance. Stay safe ya'll. Cheers! Ryan
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Natively you can only convert a single disk to a mirror. There is a hack with a limited risk of losing your data involved, but if you have a complete backup and just want to save some time and effort - assuming everything goes well - it can be done.

You need to create a sparse zvol the size of your disk on your single disk pool. The create a RAIDZ1 vdev in a new pool from your two new disks and this particular zvol. Then you move data from your single disk pool to the new one. Move is important here, because as the zvol grows you need space on your former single disk.

Once all data is moved, you destroy your old pool and the zvol, too, leaving your new pool degraded. Then replace the faulted zvol device with the old physical disk.

I did things like that converting a RAIDZ2 to a 2x mirror pool, but you need to be "fluent" on the command line with respect to ZFS and also know a bit about how TrueNAS treats the devices, because you should always create proper GPT partitions and use UUIDs instead of device names etc.

That's why I'm not trying to write out a recipe - it can be done, but you should know what exactly you are doing. There is a risk of data loss.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
 

ryandasilva

Dabbler
Joined
Jun 12, 2021
Messages
27
lol... Thanks guys.. But after careful consideration, I think im going to run an off schedule backup and create the pool from scratch. that all seems too complicated, plus the pool is encrypted and ive decided i dont need the risk of data loss that having the pool encrypted carries. I almost lost the keys once, but luckily i found a backup of them.. dont want to risk that again. this is a good opportunity to get two birds stoned at once... ;)

1) rebuild new unencrypted pool (with raidz)
2) test my backup/restore from my cloud storage provider to see if it works

i know its good practise to test if u can actually restore data so this is it!

To infinity and beyond!
 
Top