Adding mirrored drives?

roachthehuman

Dabbler
Joined
Nov 18, 2019
Messages
30
I'm sure this has been asked before but trying to find the most recent answer:

I have a 1TB drive I'm using for a Minecraft server. It's only one drive, so I added 2 1TB drives into my system. Now I want these two new drives to be part of a 3 disk 1tb mirrored array. How do I go about adding them? If I cant simply add them what would be the easiest way to build a new array and migrating the whole disk?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Identical drives? Then:
gpart backup <old drive> | gpart restore <new drive>
gpart list <new drive>
zpool status

The last two commands show you a "rawuuid" for the new drive's partition 2 and the same for the old one as "gptid/<uuid>"

To make a mirror:
zpool attach <your pool name> gptid/<id of old drive> gptid/<id of new drive>

Repeat for the second new disk to get a three-way mirror.

HTH,
Patrick
 

roachthehuman

Dabbler
Joined
Nov 18, 2019
Messages
30
What does the first part accomplish? I haven't messed with the cli in freenas at all so I want to make sure I don't screw anything up. The two new drives are are not identical, they are a different brand but both 1tb, just as the original.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
The first command copies the partition table from your old drive to one of the new drives. Provided there is no partition information on the new ones, yet. If there is you can use gpart restore -F ...

As long as you do not confuse old and new, nothing bad can happen. But unless there is something completely messed up, FreeBSD won't let you overwrite the partition table of an active disk, anyway.

Patrick

P.S. Once you got your mirror up and running, you should export and re-import your pool once via the UI. That will enable swap on all three drives.
 

roachthehuman

Dabbler
Joined
Nov 18, 2019
Messages
30
Why would I want to restore partitions on a new drive? I'm a bit confused.

I pulled the "new" drives out of another pc i had after wiping them. When I go to backup the partition from my working pool's only drive (ada4) to one of my new drives (ada0) it tells me "File exists". So is there still info on the "new" drive?

This seems to be a lot of work for just wanted to create a mirrored pool. Seems I can extend the pool quite easily in the GUI but not add mirrored disks? Seems like a bit of an oversight...
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
You want to create the same partition layout on the new drives as on the old one, don't you? ZFS vdevs reside in partitions, not on entire drives. And the way to copy a partition table from one drive to another one is: gpart backup old | gpart restore new.

To clarify: this backs up and restores a partition layout, not the partition's content!
 

roachthehuman

Dabbler
Joined
Nov 18, 2019
Messages
30
Ok so... I ran "gpart backup ada4 | gpart restore ada0" and for some reason it didnt give me the "file exists" output. It did in fact write the partition tables to the new drive when i checked with "gpart list ada0". When I try to do it for the other drive, it gives me the "file exists" output. I dont know why this is. Both of these new drives are exactly the same make and brand and were both DiskWiped for hours.

I did however manage to get ada0 to attach as a mirrored disk so I suppose it worked. Thank you so much!
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
As I wrote - for the disk that gives you the "file exists" simply add the -F flag to gpart restore. Once you are done send us the output of zpool status <your pool name> to check.
And then export and re-import the pool to get those swap partitions to good use ...

Patrick
 

roachthehuman

Dabbler
Joined
Nov 18, 2019
Messages
30
Ok I wiped the disk within freenas and it worked like a charm. I guess it had something to do with byte sector size or something. They both were from another raid array and were wiped but I guess something wasnt up to snuff. The array has been built. Kudos man +1 internet point.
 

roachthehuman

Dabbler
Joined
Nov 18, 2019
Messages
30
It says its "resilvering" at the moment. I'm gonna restart my server when its done but I think it did what I wanted it to do. Dashboard shows the pool has 3 drives atm and is healthy. If anything happens I'll back track and try your suggestion but I'm guessing the -F option formats the drive, so I suppose i did the same thing just a different way.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
No, it just overwrites the existing partition table that gave you the "file exists" error message in the first place. But since you wiped the drive clean and it is resilvering, that's fine now. You did use the "gptid/...." thingies in your commands and not "da1p2" or similar?

Patrick
 

roachthehuman

Dabbler
Joined
Nov 18, 2019
Messages
30
yea i used the really long id that came up when i ran the commands you gave me. Using "ada0" or "ada0p1" didnt work.
 
Top