fsck / GEOM / Editing files in mirror partitions separately
Warren Block
wblock at wonkity.com
Fri Oct 10 12:03:11 UTC 2014
On Thu, 9 Oct 2014, Stephan Wehner wrote:
> Hello there,
>
> I have a FreeBSD 10.0-RELEASE-p7 system with system specifics:
>
> $ mount
> /dev/mirror/gm0s1a on / (ufs, local, journaled soft-updates)
> devfs on /dev (devfs, local, multilabel)
> /dev/mirror/gm0s1b on /home (ufs, local, journaled soft-updates)
> procfs on /proc (procfs, local)
>
> $ gmirror status
> Name Status Components
> mirror/gm0 COMPLETE ada0 (ACTIVE)
> ada1 (ACTIVE)
>
> $ gpart show
> => 63 3907029104 mirror/gm0 MBR (1.8T)
> 63 3907029042 1 freebsd [active] (1.8T)
> 3907029105 62 - free - (31K)
>
> => 0 3907029042 mirror/gm0s1 BSD (1.8T)
> 0 2456848384 1 freebsd-ufs (1.1T)
> 2456848384 1433600000 2 freebsd-ufs (684G)
> 3890448384 16580658 4 freebsd-swap (7.9G)
>
> Computer was rebooted by simply turning it off. On reboot, I got
> message "error aborting boot enter full pathname or shell or return
> for /bin/sh"
>
> First question: Is it normal that the filesystem will not survive a
> power loss, so that manual intervention is needed?
> I thought UFS would be more robust.
fsck is often required when filesystem has been stopped without a clean
shutdown. This is to prevent corruption from writing to a
non-consistent filesystem.
> Now I did something that may have been a bad idea.
>
> I ran fsck on both partitions of the mirror separately, I think they
> were called ad4s1 and ad6s1. For both it reported some problems to
> fix, and I did Y until they were declared "CLEAN."
Why? A mirror is a single entity. Writes are sent to both drives, and
the whole point is that the two drives are identical. Using them
individually should be avoided.
> Then rebooted, and now the system is running fine.
>
> Second question. Is that mirror in good shape? Is there a way to test?
That's an interesting question. I don't know if there is a way to force
gmirror to check the mirror in depth. Normally, I think it just keeps
track of whether the drives are synchronized. With the mirror stopped,
the contents of both drives should be identical except for the last
block, where the gmirror metadata is stored.
> Third question. Does one even run fsck on partitions that are then
> controlled by geom?
Well, yes. But if RAID is involved, go through the RAID geom rather
than around it. So fsck the filesystems through the mirror, not on each
disk. Let gmirror keep them synchronized.
> This shows in dmesg:
>
> GEOM_MIRROR: Device mirror/gm0 launched (1/2).
> GEOM_MIRROR: Device gm0: rebuilding provider ada0.
> GEOM_MIRROR: Device gm0: rebuilding provider ada0 finished.
> GEOM_MIRROR: Device mirror/gm0 launched (2/2).
It found an unsynchronized mirror and rebuilt it, copying one entire
drive to another. This can also be forced manually with 'gmirror
rebuild'.
More information about the freebsd-fs
mailing list