# question about gmirror



## wonslung (Jun 17, 2009)

i followed the handbook for setting up gmirror today but i'm currious about something.

It seems that if you install freebsd to /dev/ad0 and it tells you to do the command to create the mirror using that same device, how does it know which device to actually save the mirror info to? and how can i check the progress/status of the mirrored device?

does it just guess based on size?


----------



## phoenix (Jun 17, 2009)

gmirror saves the metadata in the last sector of the block device (ad0) or the slice (ad0s1) depending on whether or not you use the whole drive or a single slice for the mirror.  The metadata includes the name of the mirror.

If you install onto /dev/ad0, then create a mirror called gm0 and add ad0 to it, then gmirror will save "gm0" into the last sector of ad0.  (Gross over simplification, but that's the gist of it.)


----------



## wonslung (Jun 17, 2009)

ok, but heres where i'm confused
i have 2 drives, lets call them ad0 and ad4
i install freebsd to ad0 and then follow the handbook and then do
	
	



```
gmirror label -vb round-robin gm0 /dev/ad0
```
i then edit fstab and change all /dev/ad0(whatever) to /dev/mirror/gm0(whatever)
i add 
	
	



```
geom_mirror_load="YES"
```
 to /boot/loader.conf

my question is, how does freebsd "know" to use ad4 as the mirror?
that much isn't clear from the part i read in the handbook


----------



## phoenix (Jun 17, 2009)

It doesn't.  You haven't added ad4 to the mirror yet.  So far, you have a mirror comprised of a single drive.

After you boot using the mirror, then you can *gmirror insert gm0 ad4* and it will be added to the mirror, and start to rebuild.


----------



## wonslung (Jun 17, 2009)

phoenix said:
			
		

> It doesn't.  You haven't added ad4 to the mirror yet.  So far, you have a mirror comprised of a single drive.
> 
> After you boot using the mirror, then you can *gmirror insert gm0 ad4* and it will be added to the mirror, and start to rebuild.



ok. that's what i was looking for, i swear i didn't see that...i knew something was off.

thanks so much.

one more thing:

on the mirror, do i need to create the same slice setup or will freebsd handle this itself?


----------



## phoenix (Jun 17, 2009)

Depends on whether you are mirroring the whole drive (gmirror insert gm0 ad4) or just a specific slice on the drive (gmirror insert gm0 ad4s1).  If you mirror the whole drive, gmirror takes care of everything for you.

Personally, though, I like to slice/partition/label both drives identically, manually, before adding them into the mirror.  Not sure if it makes things better or not, just a habit I have.


----------



## wonslung (Jun 17, 2009)

when i created the mirror i just followed the handbook so i did 

```
gmirror label -vb round-robin gm0 /dev/ad4
```
so when i add the other device to the mirror i can just add the entire drive, if what you're saying is true

now ad4 DOES have 2 slices on it (/ and /usr)
i plan to move everything else like /var /tmp /usr/ports /usr/src /usr/local onto zfs mount points....that's a whole NOTHER thread though


----------



## phoenix (Jun 18, 2009)

wonslung said:
			
		

> when i created the mirror i just followed the handbook so i did
> 
> ```
> gmirror label -vb round-robin gm0 /dev/ad4
> ...



Yeah, you should be able to just *gmirror insert gm0 ad6* to have the second drive added to the mirror.


----------



## wonslung (Jun 18, 2009)

yes, this worked well and quickly


----------

