# RAID1 Freebsd 8.1



## Gonefishing (Aug 30, 2010)

Sorry very much a nube with BSD I've installed the latest Freebsd from the PCBsd install disk and have networking and X working. I now wish to make a mirrored Raid1 and wish to follow this tutorial http://www.freebsd.org/doc/handbook/geom-mirror.html

However my fstab look like this:

```
# Device                Mountpoint              FStype          Options         Dump    Pass
/dev/label/rootfs0      /                       ufs             rw,noatime      1       1
/dev/label/swap0        none                    swap            sw              0       0
/dev/label/var0         /var                    ufs             rw,noatime      1       1
/dev/label/usr0         /usr                    ufs             rw,noatime      1       1
```

and uses glabel? rather than the /dev/da0 mentioned in the tutorial.

Can I use glabel and assign the /dev/label/rootfs0 for example to the raid1 partition or do I need to make fstab look like


```
# Device                      Mountpoint      FStype  Options         Dump    Pass#
/dev/mirror/gm0s1b            none            swap    sw              0       0
/dev/mirror/gm0s1a            /               ufs     rw              1       1
/dev/mirror/gm0s1d            /usr            ufs     rw              0       0
/dev/mirror/gm0s1f            /home           ufs     rw              2       2
#/dev/mirror/gm0s2d           /store          ufs     rw              2       2
/dev/mirror/gm0s1e            /var            ufs     rw              2       2
/dev/acd0                     /cdrom          cd9660  ro,noauto       0       0
```


----------



## User23 (Aug 31, 2010)

If you really need to label that gmirror the following link found by google should be interesting to you.
Dont forget to read the follow ups:
http://www.mail-archive.com/freebsd-questions@freebsd.org/msg216924.html


----------



## phoenix (Aug 31, 2010)

You can build gmirror devices out of glabel'd devices.  I do this on one server:

```
$ glabel status
        Name  Status  Components
  label/cfd0     N/A  ad4
  label/cfd1     N/A  ad6

$ gmirror status
      Name    Status  Components
mirror/gm0  COMPLETE  label/cfd0
                      label/cfd1
```

However, it works best if you label the entire disk and use the for the gmirror device.  While you can label and gmirror slices/partitions, it gets hairy really quickly, especially if you have to replace a disk.


----------



## Gonefishing (Sep 1, 2010)

Thanks phoenix that looks useful, at the moment I'm more used to mdadm and UUIDs (Linux style) could you just post what your fstab looks like.


----------



## phoenix (Sep 1, 2010)

From the same server:

```
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/mirror/gm0s1a      /               ufs     rw              1       1
/dev/label/swap         none            swap    sw              0       0
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0
```

So, I label the bare devices:
`# glabel label cfd0 ad4; glabel label cfd1 ad6`

Then I mirror the two labels:
`# gmirror label gm0 cfd0 cfd1`

The I partition the mirror device:
`# fdisk gm0; bsdlabel -e gm0s1`

Finally, I format the partition:
`# newfs /dev/mirror/gm0s1a`


----------



## Gonefishing (Sep 3, 2010)

Solved I modified the fstab to look like:


```
# Device		Mountpoint		FStype		Options	Dump Pass
/dev/mirror/gm0p2  	/			ufs		rw,noatime	1	1
/dev/mirror/gm0p3	none			swap		sw		0	0
/dev/mirror/gm0p4  	/var			ufs		rw,noatime	1	1
/dev/mirror/gm0p5	/usr			ufs		rw,noatime	1	1
```
 
after mirroring the whole drive leaving the labels alone. I've tested by removing both drives in turn to degrade the raid and it simply rebuilds after the drive is plugged back in. 

Very Cool Very Easy I was surprised and pleased not to have to add the bootloader on the added drive. I think the documentation which is good need slightly updating for the glabels.


----------



## Gonefishing (Sep 3, 2010)

How do I mark as solved?


----------

