# Unmounting gmirror'ed disks



## dmitriyit (Nov 14, 2009)

Greetings!
A rather newbie question there, but can't find help in the manual...
The situation:
1) FreeBSd 7.2 installed on remote server
2) gmirror configured with two components, ad4 and ad6, status COMPLETE, actually working; two WD Raptor drivers


```
Name    Status  Components
mirror/gm0  COMPLETE  ad4
                      ad6
```
3) file system errors on the disk (hardware is ok) 


```
veng# fsck -y
** /dev/mirror/gm0s1a (NO WRITE)
** Last Mounted on /
** Root file system
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
UNREF FILE I=1837101  OWNER=root MODE=100600
SIZE=0 MTIME=Nov 15 00:13 2009
CLEAR? no

UNREF FILE  I=1837208  OWNER=mysql MODE=140777
SIZE=0 MTIME=Nov 15 00:26 2009
RECONNECT? no


CLEAR? no

UNREF FILE I=3297364  OWNER=root MODE=140666
SIZE=0 MTIME=Nov 15 00:13 2009
CLEAR? no

UNREF FILE I=3297562  OWNER=root MODE=100644
SIZE=0 MTIME=Nov 15 00:13 2009
CLEAR? no

UNREF FILE  I=3298280  OWNER=mysql MODE=100660
SIZE=0 MTIME=Nov 15 00:26 2009
RECONNECT? no


CLEAR? no

** Phase 5 - Check Cyl groups
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? no

SUMMARY INFORMATION BAD
SALVAGE? no

BLK(S) MISSING IN BIT MAPS
SALVAGE? no

258436 files, 12785597 used, 1097483 free (63147 frags, 129292 blocks, 0.5% fragmentation)
```

Obviously, I can't get them easily fixed because I need to unmount the file system first.

The problem:
1) I can only access server remotely via SSH, so no single user mode.
2) The said gmirror is root, bootable partition.

I've tried adding fsck_y_enable="YES" (+disabling background fsck) to /etc/rc.conf to get disk checked before mounting, it did not help.
Tried unmounting the gmirror using umount, either get Unknown file system or Device busy errors.
Perhaps I'm just doing something wrong.

So I'm asking for help; can someone please explain how to fsck -y the gmirror described above? Any method would do, as long as it would get the errors fixed. It's also ok to turn off gmirror, if necessary. Please, if possible, give me example with exact commands so it will be easier to. And, is there a way to automatically fix gmirror errors on reboot?

Thanks in advance.


----------



## aragon (Nov 14, 2009)

I guess you could try fsck -B, and if that doesn't work, you could try edit /etc/rc.d/fsck to make it run an unconditional fsck -p.

You really should organise single user access.


----------



## DutchDaemon (Nov 14, 2009)

No helping hands available on the other side[1]? Someone willing to reboot with a live CD and to start sshd, so you can access/fix unmounted filesystems?

[1] this is not a religious issue


----------



## dmitriyit (Nov 15, 2009)

Thanks for the answers, currently trying to get single-user access to fix the errors.
However, is there a way to make system fsck the file system before it is mounted, during boot (fsck_y_enable="YES" alone appears not to help)? Is there a way to force pre-mounting fsck on reboot, even if file system is marked as clean?


----------



## dennylin93 (Nov 15, 2009)

dmitriyit said:
			
		

> Thanks for the answers, currently trying to get single-user access to fix the errors.
> However, is there a way to make system fsck the file system before it is mounted, during boot (fsck_y_enable="YES" alone appears not to help)? Is there a way to force pre-mounting fsck on reboot, even if file system is marked as clean?



This just appeared in the mailing list: http://lists.freebsd.org/pipermail/freebsd-current/2009-November/013474.html. It be what you're looking for.


----------

