Setup Mirror after zfs setup

Status
Not open for further replies.
Joined
Jun 13, 2011
Messages
7
Hello all,
I am currently running freenas 8.0 64bit hopefully i haven't missed something in trying to figure this out.

Synopsis of info below:
I have a zfs 1 disk drive with data on it. I want to add a disk to it to make a mirror then have it show all drives correct in webgui

in depth of my issues:
I created (using the webgui) a zfs volume with 1 disk with the intention of making it a mirror later as I had to move data around to get a free drive. So I got an available drive and wanted to add it to the volume to create a mirror. I didn't see anything in 8.0 web that would allow me to do that, so I got on the terminal. I couldn't find the command(in Solaris i think it was just "format") to show the disk names, so I looked under /dev and found the drives that were part of a volume already were in the /dev/gpt/folder but that ALL drives were in the /dev

so I ran:
zpool attach volume /dev/gpt/disk3 /dev/disk2
(not the correct names i know)
it re-silvered and was fine in the terminal.

Now obviously when I go back to the webgui and refresh, the volume still only has one drive listed. And the other drive that I had been attached is still showing as an available drive to use(obviously not something I want) :)

I believe my problem is due to the drive not being listed in gpt location as when the drives were created through the gui, they made a link to the /dev/gpt folder or something like that

Hoping someone can point me in the right direction.

thanks,
 

pauldonovan

Explorer
Joined
May 31, 2011
Messages
76
As you have discovered there's no easy way to do it in the GUI. However, I successfully added a second drive to create a mirror this past weekend so I'll describe what I did.

Note that I'm using my own build (r6661) that's a bit newer than 8.01-beta2 There have been some features added since 8.0 that make it easier. Also, I wasn't worried about losing my FreeNAS configuration in the process. What I've listed below is a bit simpler than what I ended up doing because I actually wanted to migrate my original disk that was set up in ZFSguru as well, and I did actually use the 'revert to default config' setting in the GUI a couple of times along the way.

Install your second drive, then use the GUI to create a new volume on it (call it temppool). The pool doesn't matter as we're just going through the process to get the disk partitioned and labelled correctly.

Next, click the 'Export' button for both of your pools. This is on the right of the button list in the View All Volumes screen. I believe this was added post-8.0. This is to get the volumes/pools out of the FreeNAS database but retains their on-disk setup.

From the command line, run
Code:
zpool import temppool
and again for whatever your original pool is called.

Then run
Code:
zpool status
and note the names of the disks listed inside each pool. In my case they were gptid/{some-long-guid-string}.

Next, run:
Code:
zpool destroy temppool



Now we need to add the disk that was part of temppool to the existing pool. The command is
Code:
zfs attach youroriginalpool ORIGINALDISKID NEWDISKID
Make sure you put the id of the original disk in your original pool first.

So for me it was something like:
Code:
zfs attach store gptid/oldblahblahblah gptid/newblahblahblah


ZFS will start the resilvering process which is mirroring the data to the new drive. This could take a few hours. You can check the progress by running 'zpool status'.

Now in order to be able to import it in the GUI we need to export it from the command line:
Code:
zpool export youroriginalpool

Once that's done back in the GUI you can use the 'Auto Volume Import' feature to get your volume back into the FreeNAS gui database.

As you can see, it's not the most straightforward of processes and would really benefit from being added to the GUI.

Paul
 
Joined
Jun 13, 2011
Messages
7
Yes I agree that this would be nice in a gui format. I think this is a common enough action people would want to do that it would make sense to add it.
I know that for the "home" user often you start with one drive and then as your budget allows you want to add another drive for redundancy later.


Anyways, I was able to use that to get it working right through your post
thanks for you help.
 

wreckroot

Cadet
Joined
Apr 3, 2012
Messages
1
Paul, thank you so much for your post. I was also able to create a mirror almost exactly as you had posted.

I performed this using FreeNAS-8.0.4-RELEASE-x64 (10351). Differences in my procedure were very basic....

When attaching mine did not have a gptid, but rather a simple disk ID.
zpool attach DS2000 ada0p2 ada1p2

Then to resync the GUI, I had to export at both the command line and the GUI, then use the Auto Import function.

Awesome Post! thanks again.
 
Status
Not open for further replies.
Top