Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Sep 2009 02:31:21 +0400
From:      Dmitry Marakasov <amdmi3@amdmi3.ru>
To:        freebsd-geom@FreeBSD.org
Subject:   gmirror rebuild
Message-ID:  <20090919223121.GA4601@hades.panopticon>

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

I have 2 HDD configuration, with a similar slice on each HDD dedicated
to gmirror:

---
% sudo gmirror list  
Geom name: hades
State: DEGRADED
Components: 2
Balance: round-robin
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 2
ID: 3209987644
Providers:
1. Name: mirror/hades
   Mediasize: 446421491200 (416G)
   Sectorsize: 512
   Mode: r6w5e10
Consumers:
1. Name: ad6s3
   Mediasize: 446421491712 (416G)
   Sectorsize: 512
   Mode: r1w1e1
   State: SYNCHRONIZING
   Priority: 0
   Flags: DIRTY, SYNCHRONIZING
   GenID: 0
   SyncID: 2
   Synchronized: 13%
   ID: 4192909129
2. Name: ad8s3
   Mediasize: 446421491712 (416G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: DIRTY
   GenID: 0
   SyncID: 2
   ID: 1523468916
---

The mirror itself is BSD partitioned and there are ufs and ufs/journal
filesystems on it:

---
/dev/mirror/hadesa            989M    326M    584M    36%    /
/dev/mirror/hadesd            9.7G    404M    8.5G     4%    /var
/dev/mirror/hadese            9.7G     28K    8.9G     0%    /tmp
/dev/mirror/hadesf.journal     28G    7.4G     18G    28%    /usr
/dev/mirror/hadesg.journal    361G    161G    171G    48%    /usr/home
---

I've just had power outage and the box rebooted, and the mirror
seem to be resynced from scratch (visible above). Honestly, I didn't
expect that at all, but, well, that seems to be logical actually as I
don't want different data to be read from it depending on what disk
round-robin choses.
However, I still don't like how it behaves. It seems to be copying one
disk to another completely, which much worse than fsck after cold
reboot, and it somewhat defies the purpose of mirroring, as if the drive
fails while resync, I'm screwed. If one drive has bad sectors, they may
be zeroed on another one (or am I wrong?).
First question: why doesn't it read both drives and sync only
differences?
- Reading is usually faster
- This is good for data safety. For example, the common case with modern
  crappy HDDs are the sectors which are unreadable not marked as bad by
  hdd, and are cured when the data is written over them. In the case of
  `read both disks & clone data from better one (that is, from the
  readable if another is not, or from the (I dunno the criteria) if the
  data doesn't match)` such sectors will be cured. That's somehow
  similar to zfs scrub.

Second question: is it possible to avoid syncing? gjournal(8) says the
syncing may be turned off on underlying mirror providers if it's used. I
was somehow silly to thing it'll work magically, however I doubted that
it'll work over partitioned mirror. Now thinking it over, I suppose I
can enable journalling on all partitions on my mirror and turn the
syncing off on it. Will it be safe?

Also, I have clear_tmp_enable=YES, so I don't really need syncing for
tmp. As I understand, I can only toggle syncing for the whole mirror,
not separate partitions on it. Also, I can't (shouldn't) create separate
mirrors for each partitions, cause they'll resync in parallel which is
suboptimal in terms of performance. No solution here?

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@amdmi3.ru  ..:  jabber: amdmi3@jabber.ru    http://www.amdmi3.ru



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