# UFS RAID1 mishap - stuck with / in ro-mode



## klaus (Apr 19, 2013)

Hi all

I have two hard drives in my home-server, ada0 and ada1.

I have installed FreeBSD 9.1-RELEASE on ada0, and now I wanted to create a raid1 with ada1. As per the section "Creating a Mirror with an Existing Drive" in the FreeBSD Handbook (http://www.freebsd.org/doc/en/books/handbook/geom-mirror.html), I have been fairly successful so far after a couple of retries due to silly errors on my part, and I suspect I might just have shot myself in the foot.

After creating the mirror on ada1 I modified the /etc/fstab file accordingly (almost, as you will see shortly). As far as I can see, I typed /dev/gm0xxxx instead of /dev/mirror/gm0xxxx (I could almost swear I had set it correctly) which naturally yields a load of "Can't stat /dev/gm0xxxx" errors and a subsequent abort of the boot process.

Now, the easy rollback for me would be to copy my backup of /etc/fstab back into place in order to boot from my trusty ada0 again, but I just can't mount the / filesystem in rw mode. I get no errors, but it stays in read-only mode.


```
$ cat /dev/fstab
# Device          Mountpoint       FStype  Options Dump    Pass#
/dev/gm0s1a       /                ufs     rw      1       1
/dev/gm0s1b       /home            ufs     rw      2       2
/dev/gm0s1d       /usr             ufs     rw      2       2
/dev/gm0s1e       /tmp             ufs     rw      2       2
/dev/gm0s1f       /var             ufs     rw      2       2
/dev/gm0s1g       none             swap    sw      0       0
```

Those device-paths are clear bogus when I checked:

```
$ ls -l /dev/gm0s1a
ls: /dev/gm0s1a: No such file or directory
$ ls -l /dev/mirror/gm0s1a
crw-r-----  1 root  operator    0, 117 Apr 19 01:40 /dev/mirror/gm0s1a
```

I have tested both:

```
$ mount -o rw /
```

And:

```
$ mount -o rw /dev/mirror/gm0s1a /
```

A followup attempt to create law and order again yields the following:


```
$ cp /etc/fstab.bak /etc/fstab
cp: /etc/fstab: Read-only file system
```

If I try to mount one of the other filesystems, like /home (ada0s1b), I have no problems mounting it rw and copy a file to /home for good measure

```
$ mount -o rw /dev/mirror/gm0s1b /home
$ cd /home
$ cp /etc/fstab.bak /home
$ pwd
/home
$ ls -l fstab.bak
-rw-r--r--  1 root  wheel   225 Apr 19 01:58 fstab.bak
```

I simply don't understand why / is stuck in ro.

Since the server is not doing anything right now I could just reinstall it and give it another go, but there must be something here that I am missing, either something I am not aware of, or maybe I am just completely braindead at the moment and need a kick in the rear to see the light of my wrongdoings.

I will be honest and say that I haven't been working a lot with RAIDs and it may or may not play a role here.

I hope some of you guys can help me shed some light on this!

Best regards
Klaus


----------



## wblock@ (Apr 19, 2013)

`# mount -u /`

Why no swap?


----------



## klaus (Apr 19, 2013)

Naturally, it helps by writing a post and as soon as you posted you stumble over the solution. It seems that the cure for this particular problem was that a fsck was needed.

```
fsck -y
```
And then remounting the / filesystem in rw-mode was possible, and there was much rejoice!

My apologies.

/Klaus


----------



## klaus (Apr 19, 2013)

wblock@ said:
			
		

> `# mount -u /`
> 
> Why no swap?



I actually saw this advice several places but it didn't work.
But after issuing `# fsck -y`, it worked 

I'm not sure what you are refering to about the swap; can you elaborate on that? (8G swap should be present).

Thanks for your time!

/Klaus


----------



## wblock@ (Apr 19, 2013)

Sorry, I missed it at the end of fstab there.


----------



## klaus (Apr 19, 2013)

No problem, I'm thankful for your help 

How do I mark a thread as "[Solved]"?

/Klaus


----------



## DutchDaemon (Apr 19, 2013)

http://forums.freebsd.org/forumdisplay.php?f=49 - 7 down


----------

