With a setup with two disk is there a way to migrate from software RAID1 to ZFS mirror ?

This kind of procedure would be inspired by the migration that is possible from a disk stored on a single drive to software RAID1 : setup the software RAID in degraded mode with a missing drive, copy the data, add the first drive to the array.

zpool create -f -m /data data mirror /dev/sdb 
invalid vdev specification: mirror requires at least 2 devices

Does anyone know a way of doing this ? With a fake device that writes to null ? Can ZFS change a device from "normal" to "mirror" ?


You would create a single disk device, not a mirror. Then attach a second disk to the first disk; ZFS will automatically know it has to create a Mirror VDEV for you.

zpool create -m /data data /dev/sdb
tar cf - /old/path | tar xfC - /new/path
zpool attach data /dev/sdb /dev/sdc

insert standard warning about only having a single disk with valid data during this process and intentionally stressing the disks by copy massive amounts of data - backup, backup, backups

Side note: never, never, never use the -f argument unless some ZFS Demigod Guru instructs you to do so. I guarantee 99% of the time you don't want to force it and the other 1% of the time you'll end up destroying something.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.