mdadm --detail on degraded mirror increases Events number on RHEL6.4

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL) 6.4
  • mdadm-3.2.5-4.el6.x86_64

Issue

  • mdadm --detail on degraded mirror increases Events number on RHEL 6.4
  • Is the increase of the Events counter expected behavior?

Resolution

  • This is expected behavior on mdadm --detail (-D) on a degraded mirror. Use mdadm -E to query the degraded mirror instead to not affect the Events counter.

Root Cause

  • Is this expected behavior for mdadm -D?
  • There is no special case code in the md kernel stack to handle mdadm -D differently than any other device access, so calling mdadm -D on an array will result in a transition from initial assembly to read/write mode, which triggers the event counter update.
  • Starting a device, running mdadm -D, then stopping the device sounds like a probe of the device. If that's all the steps being done, then should use mdadm -E instead. It doesn't require that the device be started, instead it queries the superblock on the constituent device directly without any array ever being started.

Diagnostic Steps

  • Stop and start /dev/md0 just to show that it's in sync:
# mdadm -A -R /dev/md0 /dev/sdb /dev/sdc
mdadm: /dev/md0 has been started with 2 drives.
# mdadm -S /dev/md0
mdadm: stopped /dev/md0
  • Start mirror with one out of two drives:
# mdadm -A -R /dev/md0 /dev/sdb
mdadm: /dev/md0 has been started with 1 drive (out of 2).
  • Get the event id from the drive that's in the mirror:
# mdadm --examine /dev/sdb |grep Events
         Events : 256
  • Run mdadm --detail /dev/md0 lots of times and the event id increases (by two for every run of the command).
# mdadm --examine /dev/sdb |grep Events
         Events : 1338
# mdadm --examine /dev/sdc |grep Events
         Events : 256
Incremented whenever the superblock is updated.
Used by mdadm in re-assembly to detect failed/out-of-sync component devices.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.