Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 06 May 2010 00:05:53 +0200
From:      Miroslav Lachman <000.fbsd@quip.cz>
To:        freebsd-geom@FreeBSD.org
Subject:   How can I disable automatic gjournal activation on the given device after hot-swap?
Message-ID:  <4BE1EBC1.5040307@quip.cz>

next in thread | raw e-mail | index | archive | help
Hi,

I have server with gjournal on top of the gmirror. Today I pulled out 
one failed drive and replace it with another used drive from spare server.
The problem is, that this drive was in another gmirror with gjournal, so 
right after the detection of ad4 on the ATA channel, the gjournal 
detected meta data on it and prevents me from adding this drive in to 
gmirror gm0.

Steps done:

root@roxy ~/# gmirror status
       Name    Status  Components
mirror/gm0  DEGRADED  ad6

root@roxy ~/# gmirror forget -v gm0
Done.

root@roxy ~/# gmirror insert -v gm0 ad4
gmirror: Cannot access provider ad4.

root@roxy ~/# ls -al /dev/ad4*
crw-r-----  1 root  operator    0,  84 Dec  7 02:22 /dev/ad4
crw-r-----  1 root  operator    0,  85 Dec  7 02:22 /dev/ad4s1
crw-r-----  1 root  operator    0, 129 Dec  7 02:22 /dev/ad4s1a
crw-r-----  1 root  operator    0, 130 Dec  7 02:22 /dev/ad4s1b
crw-r-----  1 root  operator    0, 131 Dec  7 02:22 /dev/ad4s1c
crw-r-----  1 root  operator    0, 132 Dec  7 02:22 /dev/ad4s1d
crw-r-----  1 root  operator    0, 133 Dec  7 02:22 /dev/ad4s1e
crw-r-----  1 root  operator    0, 134 Dec  7 02:22 /dev/ad4s1f
crw-r-----  1 root  operator    0,  86 Dec  7 02:22 /dev/ad4s2
crw-r-----  1 root  operator    0, 135 Dec  7 02:22 /dev/ad4s2c
crw-r-----  1 root  operator    0, 136 Dec  7 02:22 /dev/ad4s2d
crw-r-----  1 root  operator    0, 137 Dec  7 02:22 /dev/ad4s2e
crw-r-----  1 root  operator    0, 138 Dec  7 02:22 /dev/ad4s2f
crw-r-----  1 root  operator    0, 145 Dec  7 02:22 /dev/ad4s2f.journal

root@roxy ~/# dd if=/dev/zero of=/dev/ad4s2 bs=512 count=100
dd: /dev/ad4s2: Operation not permitted

root@roxy ~/# sysctl kern.geom.debugflags=16
kern.geom.debugflags: 0 -> 16

root@roxy ~/# dd if=/dev/zero of=/dev/ad4s2 bs=512 count=100
dd: /dev/ad4s2: Operation not permitted

root@roxy ~/# gjournal list
Geom name: gjournal 1576372395
ID: 1576372395
Providers:
1. Name: mirror/gm0s2d.journal
    Mediasize: 397253253632 (370G)
    Sectorsize: 512
    Mode: r1w1e1
Consumers:
1. Name: mirror/gm0s2d
    Mediasize: 398326995968 (371G)
    Sectorsize: 512
    Mode: r1w1e1
    Jend: 398326995456
    Jstart: 397253253632
    Role: Data,Journal

Geom name: gjournal 2419990975
ID: 2419990975
Providers:
1. Name: ad4s2f.journal
    Mediasize: 461697294848 (430G)
    Sectorsize: 512
    Mode: r0w0e0
Consumers:
1. Name: ad4s2e
    Mediasize: 2147483648 (2.0G)
    Sectorsize: 512
    Mode: r1w1e1
    Jend: 2147483136
    Jstart: 0
    Role: Journal
2. Name: ad4s2f
    Mediasize: 461697295360 (430G)
    Sectorsize: 512
    Mode: r1w1e1
    Role: Data

root@roxy ~/# gjournal stop -v ad4s2f.journal
Done.

root@roxy ~/# lsq /dev/ad4*
crw-r-----  1 root  operator    0,  84 Dec  7 02:22 /dev/ad4
crw-r-----  1 root  operator    0,  85 Dec  7 02:22 /dev/ad4s1
crw-r-----  1 root  operator    0, 129 Dec  7 02:22 /dev/ad4s1a
crw-r-----  1 root  operator    0, 130 Dec  7 02:22 /dev/ad4s1b
crw-r-----  1 root  operator    0, 131 Dec  7 02:22 /dev/ad4s1c
crw-r-----  1 root  operator    0, 132 Dec  7 02:22 /dev/ad4s1d
crw-r-----  1 root  operator    0, 133 Dec  7 02:22 /dev/ad4s1e
crw-r-----  1 root  operator    0, 134 Dec  7 02:22 /dev/ad4s1f
crw-r-----  1 root  operator    0,  86 Dec  7 02:22 /dev/ad4s2
crw-r-----  1 root  operator    0, 135 Dec  7 02:22 /dev/ad4s2c
crw-r-----  1 root  operator    0, 136 Dec  7 02:22 /dev/ad4s2d
crw-r-----  1 root  operator    0, 137 Dec  7 02:22 /dev/ad4s2e
crw-r-----  1 root  operator    0, 138 Dec  7 02:22 /dev/ad4s2f

root@roxy ~/# gjournal clear -v /dev/ad4s2f
Cannot clear metadata on /dev/ad4s2f: Operation not permitted.
gjournal: Not fully done.

root@roxy ~/# gjournal clear -v /dev/ad4s2e
Metadata cleared on /dev/ad4s2e.
Done.

root@roxy ~/# dd if=/dev/zero of=/dev/ad4s2 bs=512 count=100
dd: /dev/ad4s2: Operation not permitted


So the drive ad4 is still not writable by any command. (dd, bsdlabel, 
gmirror...)

How can I fix it without unloading the gjournal kernel module which is 
needed by running system?

(I can't remove the drive, I have just ssh access to the server at this 
time)

Miroslav Lachman



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4BE1EBC1.5040307>