# FreeBSD 9.0 GPT RAID 1 mirror



## Understudy (Jan 3, 2013)

Hi,

I have decided to try and do a RAID 1 mirror with the GPT. I was successful up until the reboot. 

Steps that were taken:

Fresh install of FreeBSD 9.0 


```
spider# gpart backup ada0 > ada0.gpt

spider# cat ada0.gpt
GPT 128
1   freebsd-boot        34       128  
2    freebsd-ufs       162 771751808  
3   freebsd-swap 771751970   8388608  

spider# gpart restore -F /dev/ada1 < ada0.gpt

spider# gpart show
=>       34  781422701  ada0  GPT  (372G)
         34        128     1  freebsd-boot  (64k)
        162  771751808     2  freebsd-ufs  (368G)
  771751970    8388608     3  freebsd-swap  (4.0G)
  780140578    1282157        - free -  (626M)
=>       34  781422701  ada1  GPT  (372G)
         34        128     1  freebsd-boot  (64k)
        162  771751808     2  freebsd-ufs  (368G)
  771751970    8388608     3  freebsd-swap  (4.0G)
  780140578    1282157        - free -  (626M)

spider# echo â€˜geom_mirror_load=â€YESâ€â€˜ >> /boot/loader.conf

spider# echo â€˜kern.geom.debugflags=17â€˜ >> /etc/sysctl.conf

spider# echo â€˜kern.geom.part.check_integrity=0â€˜ >> /etc/sysctl.conf

spider# shutdown -r now
```

Boot into single user mode.


```
# gmirror load
# gmirror label -vb round-robin p1 /dev/ada0p1
# gmirror label -vb round-robin p2 /dev/ada0p2
# gmirror label -vb round-robin p3 /dev/ada0p3
# mount /dev/mirror/p2 /mnt
# cd /mnt/etc
# cp fstab fstab.old
# ee fstab
```


```
# Device        Mountpoint      FStype  Options Dump    Pass#

/dev/mirror/ada0p2     /               ufs     rw      1       1
/dev/mirror/ada0p3     none            swap    sw      0       0
```

I then did gmirror status and waited till everything was 100% and complete. 

I then did reboot

When the system rebooted I got this message on my screen:

mounting from ufs;/dev/mirror/ada0p2 failed with error 19

Picture can be seen here:

http://imgur.com/Oxzp7

So I did something wrong but have no idea where.


Sincerely,

Brendhan


----------



## Understudy (Jan 3, 2013)

Okay, I am not sure how it happened but somehow the /boot/loader.conf got erased. 
I would not have believed it but I saw it happen twice. 

I had to put the install disk in and let it go to a live cd. 

At the prompt I mounted the hard drive. I change the fstab.


```
# mount /dev/ada0s1p2 /mnt
# ee /mnt/etc/fstab
```


```
# Device Mountpoint FStype Options Dump Pass#

/dev/mirror/ada0p2 / ufs rw 1 1
/dev/mirror/ada0p3 none swap sw 0 0
```

Now looks like


```
# Device Mountpoint FStype Options Dump Pass#

/dev/mirror/p2 / ufs rw 1 1
/dev/mirror/p3 none swap sw 0 0
```

I then went in and checked the loader.conf


```
#ee /mnt/boot/loader.conf
```


```
## Loader.conf file
geom_mirror_load=â€YESâ€
```

I rebooted and it did the same thing with the error 19. I did the livecd again and saw that the loader.conf file was empty. I did it again and rebooted. This time it took. 

So now things look to be working from what I can tell. 


```
spider# gmirror status
     Name    Status  Components
mirror/p1  COMPLETE  ada0p1 (ACTIVE)
                     ada1p1 (ACTIVE)
mirror/p2  COMPLETE  ada0p2 (ACTIVE)
                     ada1p2 (ACTIVE)
mirror/p3  COMPLETE  ada0p3 (ACTIVE)
                     ada1p3 (ACTIVE)
spider#
```

So things are looking better. 

Sincerely,

Brendhan


----------



## wblock@ (Jan 3, 2013)

Understudy said:
			
		

> ```
> spider# echo â€˜kern.geom.debugflags=17â€˜ >> /etc/sysctl.conf
> spider# echo â€˜kern.geom.part.check_integrity=0â€˜ >> /etc/sysctl.conf
> ```



Permanently disabling the safety and telling the system to ignore corrupted and overlapping partitions is a mistake.  Those features are there to protect your data.


----------



## Understudy (Jan 4, 2013)

wblock@ said:
			
		

> Permanently disabling the safety and telling the system to ignore corrupted and overlapping partitions is a mistake.  Those features are there to protect your data.



I will remove them and reboot. Thank you. 

Sincerely,

Brendhan


----------

