Convert to ZFS Mirror

Status
Not open for further replies.

Zythyr

Dabbler
Joined
Mar 4, 2013
Messages
42
Is it possible to convert from a regular ZFS volume to a ZFS mirrored volume without losing the data?

I have 2x 3TB hard drives, but my old desktop only as 1x slot for a 3.5" hard drive. Few months later, I expect to have another desktop available with 2x 3.5" hard drive slots. If I set up FreeNAS with only 1x 3TB hard drive, can I in the future convert my freeNAS system to a mirrored volume when I have another hard drive slot available?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Yep. Sure can. It's the only vdev change you can make.
 

Zythyr

Dabbler
Joined
Mar 4, 2013
Messages
42
Yep. Sure can. It's the only vdev change you can make.
How can I do this? Is it command line or I can do it with the GUI interface? It is easy to do? Is there a guide on this?

It it possible to from a mirrored ZFS volume to just a regular non-mirrored volume without losing data?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
You have to do it from the CLI I believe.

You can add and remove mirrors, but only from the CLI. If you try to do it from the GUI you'll have to wipe out your data to create a new pool with the mirror.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Not sure of the exact command though. You'd be wise to google the zfs commands and test it in a VM before doing it to your pool.
 

Dusan

Guru
Joined
Jan 29, 2013
Messages
1,165
Not sure of the exact command though. You'd be wise to google the zfs commands and test it in a VM before doing it to your pool.
It's:

zpool attach pool device new_device

Attaches new_device to an existing zpool device. The existing device
cannot be part of a raidz configuration. If device is not currently
part of a mirrored configuration, device automatically transforms
into a two-way mirror of device and new_device. If device is part of
a two-way mirror, attaching new_device creates a three-way mirror,
and so on. In either case, new_device begins to resilver immediately.

This can't be stressed enough: read all available documentation and test it in a VM first!
 
Joined
May 19, 2014
Messages
5
Aaron - thanks for your guide. Whilst I ignored the encryption bits, everything else was very useful and I've managed to convert my single disk stripe to a mirror.
 

david kennedy

Explorer
Joined
Dec 19, 2013
Messages
98
I need to do this also without encryption. Was it as simple as that one command line?

If you were using a pure "solaris" based system it would be as simple as what Dusan posted (zpool attach pool device new_device).
In freenas it is a bit more complicated as by default there are other partitions created on the disk as well (swap, etc).

From a solaris box at my disposal (single disk).

NAME STATE READ WRITE CKSUM
zones ONLINE 0 0 0
c1t0d0 ONLINE 0 0 0

If i wanted to mirror this i would just use "zpool attach zones c1t0d0 c2t0d0 " (no need to format the disk, etc).

Under freenas it looks like this

NAME STATE READ WRITE CKSUM
z01 ONLINE 0 0 0
gptid/26dea608-c80c-11e3-ab6b-080027dc6d1c ONLINE 0 0 0


There is a posting here on the forums of how to do this by copying the partition table of the original disk to the new disk first.
 
Status
Not open for further replies.
Top