# going from gmirror to ZFS root



## dvl@ (Feb 24, 2013)

A theoretical question...

I am about to create a 6 disk raidz2 configuration on FreeBSD 9.1.  I plan to make it zfsroot (that is, the whole OS on ZFS).  The system is already running on a gmirror.  The problem: how to transfer the system from the gmirror to ZFS if I can only attach 6 HDD at a time.

My first thought, now abandoned was:

1 - connect the 6HDD.
2 - boot from a USB key
3 - create the zpool
4 - shutdown
5 - remove one HDD
6 - replace it with one of the two disks from the gmirror
7 - boot from the USB key again
8 - use tar piped to tar to copy the various partitions.
9 - shutdown
10 - swap the gmirror disk for the original HDD
11 - power up
12 - profit

Since that cunning idea, I realized I have a 2-port SATA card I can install, then boot from the USB, and do all of the above from within that configuration.

But I'm curious, what do you think of that original plan? feasible?


----------



## ondra_knezour (Feb 24, 2013)

I have seen little more complicated, but less shutdowns requiring approach - remove one disk from mirror, put in five disks for ZFS RAIDZ2, create one virtual disk, create pool from five disks plus the virtual one, put virtual disk offline, transfer data, replace offline virtual disk with remaining disk from gmirror, reboot. Backup is on disk removed from computer at beginning.


----------



## wblock@ (Feb 24, 2013)

You could boot from one drive of the mirror, with five of the RAIDZ2 array connected.  No need for the USB boot.

But it should work.  dump(8)/restore(8) could be used to copy the data, since restore(8) writes at the filesystem level.  And also there's net/rsync, which with the latest patches and the FLAGS option set, can copy full FreeBSD filesystems with all attributes.  Can't recall if ZFS supports file flags anyway, maybe that does not matter.


----------



## dvl@ (Nov 20, 2013)

For the record, I went with a completely fresh install. However, I'm about to do the same thing on a remote server. In this case, I will remove one HDD from the `gmirror`, set it up, boot from it, then add in the other HDD. I'm about to start a new post regarding that process.


----------

