# gmirror, glabel and slices



## wonslung (Jul 1, 2009)

I've installed freebsd on another machine with gmirror, and it worked fine....but on this new one i'm having some trouble.

First of all, what i'd like to do is this:

I'd like to only use gmirror to mirror the first slice on 2 drives.  Is this possible? when i try it i get 
	
	



```
Can't store metadata on /dev/ad6s1a: Operation not permitted
```

i'd also like to use glabel to label the slices to make sure they don't get mixed up if i move controllers or install a new drive.  


What i'd like is this:

I have 2 drives, 250GB's Each, i want to make a single gmirror slice of 1024m or 2048m  then have a slice for swap, not mirrored, then have 2 slices i can use for ZFS as a ZFS mirror.

I'm running into problems trying to mirror a single slice.

Thanks for any help

edit:

also, i didn't forget to set the sysctl kern.geom.debugflags=16


----------



## aragon (Jul 1, 2009)

It is possible to gmirror specific slices.  That's how mine is setup.  Looks like you're trying to gmirror a partition, rather than a slice though.  Have you tried specifying ad6s1 instead of ad6s1a?


----------



## wonslung (Jul 2, 2009)

aragon said:
			
		

> It is possible to gmirror specific slices.  That's how mine is setup.  Looks like you're trying to gmirror a partition, rather than a slice though.  Have you tried specifying ad6s1 instead of ad6s1a?



i'm an idiot, coming from linux and only migrating to freebsd recently i still use the wrong word from time to time.

I had slice and partition backwards i think.


Can you mirror just a parition?
i only want to mirror ad6s1a onto ad7s1a if possible
like i said, i have 2 drives with the exact same geometry.
both 250GB drives

i want to gmirror the first partition which is where /boot lives

the second partiton on each drive is swap and the third partition is for a ZFS mirror 

if it turns out that i CANT do it with gmirror i can manually copy it i think considering that lives there is my /boot info


----------



## aragon (Jul 2, 2009)

wonslung said:
			
		

> Can you mirror just a parition?
> i only want to mirror ad6s1a onto ad7s1a if possible
> like i said, i have 2 drives with the exact same geometry.
> both 250GB drives
> ...


AFAIK, partitions can't be added to a gmirror array.  I do something similar to you, but I made a dedicated slice for swap so that it didn't have to be in the mirror.


----------



## wonslung (Jul 2, 2009)

yah, it's no big deal...it's just the /boot partition anyways...i could probably "mirror" it with rsync or even cpio in a script seeing as it won't change often.  I'll also know next time to use slices instead.  I was following the online guide on how to use zfs as everything except /boot and it said to use a single large slice with 3 partions.  I'll know better next time.

Question:  If i had everything set up the way i wanted more or less and i wanted to reslice/repartion how hard would it be to  backup the data onto another machine and then put it back?


I have a fairly nice fileserver running FreeBSD and ZFS, samba and NFS shares.


----------



## aragon (Jul 3, 2009)

wonslung said:
			
		

> Question:  If i had everything set up the way i wanted more or less and i wanted to reslice/repartion how hard would it be to  backup the data onto another machine and then put it back?


That should be trivial if you can connect the drive to that other machine.  All you need to do is archive the data (using tar, or whatever works best), repartition, setup the boot manager if any, and then unarchive the data back.


----------



## wonslung (Jul 3, 2009)

aragon said:
			
		

> That should be trivial if you can connect the drive to that other machine.  All you need to do is archive the data (using tar, or whatever works best), repartition, setup the boot manager if any, and then unarchive the data back.



That's what i thought, i've never tried anything like that.

Just wanted to know if there was anything "not obvious" i was missing.  

I normally use something like this to archive data

```
find -x somedir/ | cpio -pmd /some/other/dir
```
i wasn't sure if there was anything that would cause a problem.


----------



## aragon (Jul 3, 2009)

Not familiar with cpio.  I generally use tar.

Say your data is mounted at /mnt and your backup drive is at /backup

tar czpf /backup/backup.tar.gz /mnt/*

But for ZFS filesystems there is probably a better/faster approach...


----------



## wonslung (Jul 3, 2009)

i've used tar before but i've found cpio to be better
it preserves hard links for one.
it also preserves timestamps by default.  

but anyways when i DID use tar i'd do it like this:

```
tar cf - * | ( cd /target; tar xfp -)
```
from inside the directory i wanted to backup.

last time io tried zfs send / zfs recieve it was kinda slow.


----------

