Convert standalone zpool to RAID1 with data in place

Fox F fox at cyberfoxfire.com
Mon Nov 5 17:46:52 UTC 2012


On 11/3/2012 10:23 PM, Freddie Cash wrote:
>
> You don't. At least, not in that order. Or, at least not with the 
> ZFS-native tools.
>
> You can create a pool with 2 separate single-disk vdevs, and data will 
> be striped across them. Similar to RAID0, there will be no redundancy 
> to the pool.
>     zpool create poolname disk1 disk2
>
> Later, you can convert the single-disk vdevs to mirrors, thus turning 
> the pool into a RAID10:
>     zpool attach poolname disk1 disk3
>     zpool attach poolname disk2 disk4
>
> Or, you can create a pool with a single mirror vdev:
>     zpool create poolname mirror disk1 disk2
>
> Later, you can add another mirror vdev to the pool, and data will be 
> striped across the two vdevs, similar to a RAID10:
>     zpool add poolname mirror disk3 disk4
>
> If you are truly hell bent on doing things in the other order (mirror 
> on top of two stripesets), then you have to use gstripe(8) to create 
> the stripesets, and then add those to the pool. The following is from 
> memory, so it may not be perfectly correct:
>     gstripe label stripe1 disk1 disk2
>     gstripe label stripe2 disk3 disk4
>     zpool create poolname mirror stripe/stripe1 stripe/stripe2
>
> On Nov 3, 2012 11:17 AM, "Fox F" <fox at cyberfoxfire.com 
> <mailto:fox at cyberfoxfire.com>> wrote:
> >
> > Hello,
> >
> > My intention is to have a zpool with two drives (1TB and 2TB) 
> striped. I suppose I'd create it as such:
> >
> > zpool create zp_test disk1 disk2
> >
> > I would then create a zfs filesystem on that zpool and add data to it.
> >
> > Then, I would want to mirror this data on another identical striped 
> vdev.
> >
> > The question is, what is the order of operations for creating the 
> second striped vdev and adding it as a mirror to the first one, and 
> how do I do that in such a way that the data on disk1/2 gets mirrored 
> to the new addition?
> >
> > I hope I am making sense.
> >
> > -F
> > _______________________________________________
> > freebsd-fs at freebsd.org <mailto:freebsd-fs at freebsd.org> mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-fs
> > To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org 
> <mailto:freebsd-fs-unsubscribe at freebsd.org>"
>
I did forget one point to have clarified.

Forget the striping. Let's just assume two disks, 1 and 2.

I only have disk1 on hand. So I create a zpool/zfs with it.

# zpool create mypool disk1
# zfs create mypool/repository

Then some data is put on the zfs. Now, I want to convert mypool to a 
mirror with disk2, while keeping the data on disk1 intact. Is there a 
way to do that?


More information about the freebsd-fs mailing list