# RAID1 mismatch_cnt [solved]

## DragonK

Hi,

I've got a RAID 1 setup (using software raid) and mounted under /  (ext3).  

The problem I'm facing is that almost every time I perform a raid check (by using  echo "check" >> /sys/block/md0/md/sync_action) I get 256 or 128 mismatched blocks in /sys/block/md0/md/mismatch_cnt.   :Sad:   I do a "repair" and after a while the mismatch_cnt is back up. 

Any ideas why this is happening? The filesystem doesn't seem to be corrupt and the hard drives are ok, according to S.M.A.R.T.

```

# uname -a

Linux test 2.6.23-gentoo-r5 #3 SMP Thu Jan 17 14:05:31 EET 2008 x86_64 Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz GenuineIntel GNU/Linux

# mdadm -D /dev/md0

/dev/md0:

        Version : 00.90.03

  Creation Time : Thu Jan 10 01:28:41 2008

     Raid Level : raid1

     Array Size : 32001344 (30.52 GiB 32.77 GB)

  Used Dev Size : 32001344 (30.52 GiB 32.77 GB)

   Raid Devices : 2

  Total Devices : 2

Preferred Minor : 0

    Persistence : Superblock is persistent

    Update Time : Fri Jan 18 10:16:52 2008

          State : clean

 Active Devices : 2

Working Devices : 2

 Failed Devices : 0

  Spare Devices : 0

           UUID : 13bce45e:28d4e21f:513c4e78:06a095aa

         Events : 0.46

    Number   Major   Minor   RaidDevice State

       0       8        1        0      active sync   /dev/sda1

       1       8       17        1      active sync   /dev/sdb1

```

Last edited by DragonK on Thu Jan 24, 2008 12:58 pm; edited 1 time in total

----------

## pelkeyj

Do you have a swap file on that partition?  I have seperate swap partitions (in sw RAID1 arrays) and I get a mismatch_cnt on them all the time.  Also, it's considered normal (and completely harmless) for swap to get mismatched.  So, if you do have swap files on that partition, and have enough memory that you don't need swap files, disable them for a few days and see what happens with mismatch_cnt.  But be warned: linux has a tendency to crash if you use up all your memory with no swap files/partitions.

----------

## DragonK

I do have a swap partition, but it's not included in the raid. It's somewhere at /dev/sda2 it think (i'm not at that computer right now...)

----------

## pelkeyj

When you check the RAID array, is it while the filesystem is live?

----------

## DragonK

Well, yeah, since it's my root partition (/)... but I try to keep disk i/o activity to a minimum while checking the raid (stopping all daemons, logging out users, etc.)... I'll try to boot from a livecd and do the check like that next time, to see if there are still differences.

----------

## DragonK

It seems that I've had some hard to detect memory problems (hardware incompatibility), so I had to replace the whole RAM. I suspect this was part of the problem with the RAID.

----------

