In opposite to Linux’ mdadm, ZFS doesn’t provide a possibility to create a Raid with a missing disk. Therefore it’s not possible to create a RaidZ with two of three devices added. But this is essential for my migration from the old NAS. Fortunaly a RaidZ can be created either with disks or with files. This gives us the chance, to fake a third disk and remove it before copying the data.
deveth0@nas:~# mkfile -n 1500G fakedisk
Afterwards we create a RaidZ pool with two disks and one file. The file can be deleted after the successful creation. If you now start a ZFS scrub you’ll see the “faulty” devices in the pool’s status. As we want to share the pool with samba, we need to add the “-o casesensitivity=mixed” option.
deveth0@nas:~# zpool create tank raidz c0 c3t4d0 c3t5d0 ~/fakedisk
deveth0@nas:~# rm fakedisk
deveth0@nas:~# zpool scrub tank
pool: tank
state: ONLINE
scan: scrub repaired 0 in 4h32m with 0 errors on Fri Jul 15 11:35:36 2011
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
c3t4d0 ONLINE 0 0 0
c3t5d0 ONLINE 0 0 0
~/fakedisk2 UNAVAIL 0 0 0 cannot open
Now we can copy the data from Debian to the ZFS-pool. I decided to rsync the data via ssh. After finishing, add the new drive to your system and then replace the fakedisk with it.
deveth0@nas:~# rsync -avPe ssh root@nas_old:/mnt/data/ /tank/
deveth0@nas:~# ...
deveth0@nas:~# zpool replace tank ~/fakedisk c3t6d0
deveth0@nas:~# zpool status tank
pool: tank
state: ONLINE
scan: scrub repaired 0 in 4h32m with 0 errors on Fri Jul 15 11:35:36 2011
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
c3t4d0 ONLINE 0 0 0
c3t5d0 ONLINE 0 0 0
c3t6d0 ONLINE 0 0 0