Convert standalone zpool to RAID1 with data in place
Fox F
fox at cyberfoxfire.com
Mon Nov 5 18:28:47 UTC 2012
On 11/5/2012 11:53 AM, Steven Hartland wrote:
> ----- Original Message ----- From: "Fox F" <fox at cyberfoxfire.com>
>
>> 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?
>
> Yes off hand you want "zpool attach mypool disk1 disk2" more details in
> "man zpool"
>
> Regards
> Steve
>
> ================================================
> This e.mail is private and confidential between Multiplay (UK) Ltd.
> and the person or entity to whom it is addressed. In the event of
> misdirection, the recipient is prohibited from using, copying,
> printing or otherwise disseminating it or any information contained in
> it.
> In the event of misdirection, illegible or incomplete transmission
> please telephone +44 845 868 1337
> or return the E.mail to postmaster at multiplay.co.uk.
>
Alright, I think I got it!
"zpool attach" adds a new device to an existing one as a mirror, whereas
"zpool add" adds it as a stripe.
For example,
# zpool create mypool disk1
I now have a single vdev pool.
# zpool add mypool disk2
I now have a striped two-disk pool.
# zpool attach mypool disk1 disk3
Now, I have the following:
mypool
mirror-0
disk1
disk3
disk2
FINALLY, if I want to add disk4, I would say,
# zpool attach mypool disk2 disk4
which would give
mypool
mirror-0
disk1
disk3
mirror-1
disk2
disk4
Which would give me what I need. So to Freddie, this is exactly what you
recommended, and fortunately will work for my circumstances. I guess
what confused me was how attach vs. add work, and the resulting disk
layout. Now, after some testing on my server, I see how it all works.
Thanks for the education.
More information about the freebsd-fs
mailing list