Adding a Drive to turn an existing Stripe into a Mirror

Status
Not open for further replies.

josecuervo

Dabbler
Joined
Jan 19, 2015
Messages
42
Running FreeNAS-9.3-STABLE fully updated.

I have one 3TB drive and I want to add another to create a mirror. I plan to follow this post:

OMG! What a nerve wrecking ride. IT WORKED! No complaints from FreeNas GUI. Thanks so much fellas!

Here's the steps along with my setup for future reference
  • FreeNas version 9.2.1.5 booted from 16gb USB stick
  • One volume consisting of 2x2tb mirror and a single stripe 1x1tb drive
Steps to convert a single stripe to mirror
  1. From GUI, detach the volume, shutdown and unplug the existing drives. Install a fresh 1x1tb drive.
  2. Startup again and you should only see one disk under View Disks. Run the command with Shell and clear any existing partitions on the new drive

    Code:
    gpart destroy -F /dev/ada0


  3. Create the new partitions

    Code:
    gpart create -s gpt /dev/ada0
    gpart add -a 4k -i 1 -s 2g -t freebsd-swap /dev/ada0
    gpart add -a 4k -i 2 -t freebsd-zfs /dev/ada0

  • Check out the new gptid for the drive and copy down the gptid for ada0p2

    Code:
    glabel status

  • Shut down. Replug all the drives. Restart. Go to Storage and Auto-Import the volume

  • Go to Volume Status and take note of the name for the stripe eg ada1p2

  • Check out the gptid again and this time find the gptid for ada1p2

    Code:
    glabel status

  • Finally, run the command to set the stripe as a mirror where tank is the name of the volume. IMPORTANT: gptid for the existing disk comes first

    Code:
    zpool attach tank /dev/gptid/[gptid_of_the_existing_disk] /dev/gptid/[gptid_of_the_new_partition]

  • Go back to the GUI Volume Status and you'll see a new mirror. You can check the reslivering process with the following command

    Code:
    zpool status

Any comments before I start?

Thanks,
Jose
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
Never tried so I can't comment on it, but as a side question do you have any backup plans?
If you have another drive, same size or bigger, then you can use replication. One way would be to create your mirror first, then do replication from your existing drive to the mirror. After replication is done, you will need to link the various shares and accounts to the new mirror and take the drive with the existing data out of the system as backup.
Or you can replicate to a larger drive, then disconnect old drive and create a new mirror from it and the new drive. You can then import the old backup through replication, the same way you went.
The replication approaches, while a bit daunting is in my opinion a bit safer approach to your problem. You can fail (and you should still have your data, unless for user entry error) and try until you succeed, while yours could potentially cost you your data.
 

mjws00

Guru
Joined
Jul 25, 2014
Messages
798
It's pretty tough to screw up your data with those directions. Your data is physically disconnected while you are building the second part of the mirror. Nothing is perfect, but those are literally the commands the GUI runs when building a mirror... so it is the best we can do. Obviously a tested backup would be smart. Go slow, but don't sweat it too much.

Good luck.
 

josecuervo

Dabbler
Joined
Jan 19, 2015
Messages
42
It's pretty tough to screw up your data with those directions. Your data is physically disconnected while you are building the second part of the mirror. Nothing is perfect, but those are literally the commands the GUI runs when building a mirror... so it is the best we can do. Obviously a tested backup would be smart. Go slow, but don't sweat it too much.

Good luck.

Is there a GUI way to do what I'm trying to do? Or are you referring to an initial setup
 

mjws00

Guru
Joined
Jul 25, 2014
Messages
798
No way to do this in the GUI. But they do have the mechanism for a boot pool so perhaps it will come one day.
 

josecuervo

Dabbler
Joined
Jan 19, 2015
Messages
42
So far so good. On to the zpool attach command. Here is my glabel status:

Screen Shot 2015-02-12 at 7.15.43 AM.png


Ok I know my original disk is ada0p2 from the Volume list but how do I know which which of these gptids is correct for my new disk? Sorry total noob. My guess is ada1p2.
 

mjws00

Guru
Joined
Jul 25, 2014
Messages
798
Correct
 

Sean Coston

Contributor
Joined
Jul 25, 2014
Messages
128
I just converted a 3 disk bastardized stripe into a two disk mirrored volume using these instructions. My server only allows for 4 SATA disks, so I had to mount 1x4TB and then copy my data over to it from the 3 disk stripe (1x2TB + 2x500GB) then decommission the smaller disks to make room for the 2nd 4TB disk and construct my mirror.

Worked perfectly.

Thank you so much for figuring this out and posting.

Next I'm installing two more 4TB disks in a mirror then adding the mirror to the volume. That's what I want right? a stripe of mirrors and not a mirror of stripes.
 

mjws00

Guru
Joined
Jul 25, 2014
Messages
798
Yep. No way to mirror stripes in zfs. You will have one mirrored vdev and add another.

Glad it worked for ya.
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
Guys, this is just an FYI. You're doing CLI stuff behind the GUI. There is no way for the middle-ware to know what the heck you did and how to handle it in case of a fault. The correct way to do this is back-up the data, rebuild the vdev as a mirror using the GUI.
 

Bjonness406

Dabbler
Joined
May 30, 2015
Messages
28
So I should just copy all my data to a external usb harddrive and make the mirror, then copy it back again?
Can I do that if I plug the harddrive into my freenas machine, or do I need to do it with a client?
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
In a perfect world, yes. Backup your data any way you choose, then destroy and rebuild the pool correctly. Personally, I'd plug the external drive into a client machine and backup over the wire.
 

Bjonness406

Dabbler
Joined
May 30, 2015
Messages
28
In a perfect world, yes. Backup your data any way you choose, then destroy and rebuild the pool correctly. Personally, I'd plug the external drive into a client machine and backup over the wire.
Thanks for your help, doing it now :D

Taking a day to copy everything over -_- :p
Edit: Down to 4 hours, not that bad
 
Last edited:

Bjonness406

Dabbler
Joined
May 30, 2015
Messages
28
Wait...

Should I backup my data with just copying the folders and set up everything again,
or can I go to System > Advanced > Backup > Backup data?

Or is there any better way to backup without having to set up permissions again, or dataset?
 
Status
Not open for further replies.
Top