resync on every raidstart
Every time I stop a RAID1 device with raidstop, and start it again with raidstart, it resyncs. Is this normal, or am I doing something wrong? Here is an example with a RAID1 device on two loopback devices:
# cat /etc/raidtab raiddev /dev/md0 raid-level 1 nr-raid-disks 2 nr-spare-disks 0 chunk-size 4 device /dev/loop1 raid-disk 0 device /dev/loop2 raid-disk 1 # mkraid /dev/md0 handling MD device /dev/md0 analyzing super-block disk 0: /dev/loop1, 10240kB, raid superblock at 10176kB disk 1: /dev/loop2, 10240kB, raid superblock at 10176kB
Sep 21 19:30:16 zaphod kernel: md: bind<loop1> Sep 21 19:30:16 zaphod kernel: md: bind<loop2> Sep 21 19:30:16 zaphod kernel: raid1: raid set md0 active with 2 out of 2 mirrors Sep 21 19:30:16 zaphod kernel: md: syncing RAID array md0 Sep 21 19:30:16 zaphod kernel: md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc. Sep 21 19:30:16 zaphod kernel: md: using maximum available idle IO bandwith (but not more than 200000 KB/sec) for reconstruction. Sep 21 19:30:16 zaphod kernel: md: using 128k window, over a total of 10176 blocks. Sep 21 19:30:17 zaphod kernel: md: md0: sync done.
# raidstop /dev/md0
Sep 21 19:30:31 zaphod kernel: md: md0 stopped. Sep 21 19:30:31 zaphod kernel: md: unbind<loop2> Sep 21 19:30:31 zaphod kernel: md: export_rdev(loop2) Sep 21 19:30:31 zaphod kernel: md: unbind<loop1> Sep 21 19:30:31 zaphod kernel: md: export_rdev(loop1)
# raidstart /dev/md0
Sep 21 19:30:46 zaphod kernel: md: autorun ... Sep 21 19:30:46 zaphod kernel: md: considering loop2 ... Sep 21 19:30:46 zaphod kernel: md: adding loop2 ... Sep 21 19:30:46 zaphod kernel: md: adding loop1 ... Sep 21 19:30:46 zaphod kernel: md: created md0 Sep 21 19:30:46 zaphod kernel: md: bind<loop1> Sep 21 19:30:46 zaphod kernel: md: bind<loop2> Sep 21 19:30:46 zaphod kernel: md: running: <loop2><loop1> Sep 21 19:30:46 zaphod kernel: raid1: raid set md0 active with 2 out of 2 mirrors Sep 21 19:30:46 zaphod kernel: md: ... autorun DONE. Sep 21 19:30:46 zaphod kernel: md: syncing RAID array md0 Sep 21 19:30:46 zaphod kernel: md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc. Sep 21 19:30:46 zaphod kernel: md: using maximum available idle IO bandwith (but not more than 200000 KB/sec) for reconstruction. Sep 21 19:30:46 zaphod kernel: md: using 128k window, over a total of 10176 blocks. Sep 21 19:30:47 zaphod kernel: md: md0: sync done.
I'm using raidtools2 version 1.00.3, and kernel 2.6.0-test5 with the following configuration:
CONFIG_MD=yCONFIG_BLK_DEV_MD=y
# CONFIG_MD_LINEAR is not set
# CONFIG_MD_RAID0 is not setCONFIG_MD_RAID1=y
# CONFIG_MD_RAID5 is not set
# CONFIG_MD_MULTIPATH is not setCONFIG_BLK_DEV_DM=y
# CONFIG_DM_IOCTL_V4 is not set
Signature · 3 lines
Dick Streefland //// De Bilt [email protected] (@ @) The Netherlands ------------------------------oOO--(_)--OOo------------------
Quoted 3 lines · On Sunday September 21, [email protected] wrote:
Every time I stop a RAID1 device with raidstop, and start it again with raidstart, it resyncs. Is this normal, or am I doing something wrong? Here is an example with a RAID1 device on two loopback
devices:
I cannot reproduce this.
Does it happen with real devices, or only loopback devices?
Can you try with mdadm and see if that makes a difference?
After raidstop, and before raidstart, can you
mdadm -E /dev/loop1
mdadm -E /dev/loop2
and show me the results?
Thanks,
NeilBrown
Neil Brown <[email protected]> wrote:
| I cannot reproduce this. | Does it happen with real devices, or only loopback devices? | | Can you try with mdadm and see if that makes a difference? | | After raidstop, and before raidstart, can you | | mdadm -E /dev/loop1 | mdadm -E /dev/loop2 | | and show me the results?
This is the output of mdadm-1.3.0:
# mdadm -E /dev/loop1
/dev/loop1:
Magic : a92b4efc
Version : 00.90.00
UUID : 44f2804a:f7890a34:bd644666:becddad4
Creation Time : Tue Sep 23 21:08:17 2003
Raid Level : raid1
Device Size : 10176 (9.94 MiB 10.42 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0 Update Time : Tue Sep 23 21:08:33 2003
State : dirty, no-errors
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Checksum : e0ba675d - correct
Events : 0.2
Number Major Minor RaidDevice State
this 0 7 1 0 active sync /dev/loop1
0 0 7 1 0 active sync /dev/loop1
1 1 7 2 1 active sync /dev/loop2
# mdadm -E /dev/loop2
/dev/loop2:
Magic : a92b4efc
Version : 00.90.00
UUID : 44f2804a:f7890a34:bd644666:becddad4
Creation Time : Tue Sep 23 21:08:17 2003
Raid Level : raid1
Device Size : 10176 (9.94 MiB 10.42 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0 Update Time : Tue Sep 23 21:08:33 2003
State : dirty, no-errors
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Checksum : e0ba6760 - correct
Events : 0.2
Number Major Minor RaidDevice State
this 1 7 2 1 active sync /dev/loop2 0 0 7 1 0 active sync /dev/loop1 1 1 7 2 1 active sync /dev/loop2
I guess the "dirty" state is the problem?
I also created a RAID1 array on another machine (2.6.0-test5 kernel, raidtools-1.00.3, mdadm-0.7.2) with real disks:
# mkraid /dev/md3 handling MD device /dev/md3 analyzing super-block disk 0: /dev/hda3, 535752kB, raid superblock at 535680kB disk 1: /dev/hdb3, 535752kB, raid superblock at 535680kB
... waiting for sync completion ...
# mdadm -E /dev/hda3
/dev/hda3:
Magic : a92b4efc
Version : 00.90.00
UUID : 8e85542d:e073310b:b5478b9a:67ea873f
Creation Time : Tue Sep 23 21:38:39 2003
Raid Level : raid1
Device Size : 535680 (523.12 MiB 548.53 MB)
Raid Disks : 2
Total Disks : 2
Preferred Minor : 3 Update Time : Tue Sep 23 21:49:36 2003
State : dirty, no-errors
Active Drives : 2
Working Drives : 2
Failed Drives : 0
Spare Drives : 0
Checksum : b43f696d - correct
Events : 0.1
Number Major Minor RaidDisk State
this 0 3 3 0 active sync /dev/hda3
0 0 3 3 0 active sync /dev/hda3
1 1 3 67 1 active sync /dev/hdb3
# raidstop /dev/md3
# mdadm -E /dev/hda3
/dev/hda3:
Magic : a92b4efc
Version : 00.90.00
UUID : 8e85542d:e073310b:b5478b9a:67ea873f
Creation Time : Tue Sep 23 21:38:39 2003
Raid Level : raid1
Device Size : 535680 (523.12 MiB 548.53 MB)
Raid Disks : 2
Total Disks : 2
Preferred Minor : 3 Update Time : Tue Sep 23 21:50:45 2003
State : dirty, no-errors
Active Drives : 2
Working Drives : 2
Failed Drives : 0
Spare Drives : 0
Checksum : b43f69b4 - correct
Events : 0.2
Number Major Minor RaidDisk State
this 0 3 3 0 active sync /dev/hda3 0 0 3 3 0 active sync /dev/hda3 1 1 3 67 1 active sync /dev/hdb3
A raidstart resulted in a second resync, but after that, it is clean:
# mdadm -E /dev/hda3
/dev/hda3:
Magic : a92b4efc
Version : 00.90.00
UUID : 8e85542d:e073310b:b5478b9a:67ea873f
Creation Time : Tue Sep 23 21:38:39 2003
Raid Level : raid1
Device Size : 535680 (523.12 MiB 548.53 MB)
Raid Disks : 2
Total Disks : 2
Preferred Minor : 3 Update Time : Tue Sep 23 22:20:08 2003
State : clean, no-errors
Active Drives : 2
Working Drives : 2
Failed Drives : 0
Spare Drives : 0
Checksum : b43f709c - correct
Events : 0.4
Number Major Minor RaidDisk State
this 0 3 3 0 active sync /dev/hda3 0 0 3 3 0 active sync /dev/hda3 1 1 3 67 1 active sync /dev/hdb3
However, the RAID1 array on the loopback devices stays "dirty", even after multiple raidstop/raidstart commands.
Signature · 3 lines
Dick Streefland //// De Bilt [email protected] (@ @) The Netherlands ------------------------------oOO--(_)--OOo------------------
I did some more tests, and it looks like my problem may be related to SMP. When I setup a RAID1 array on my SMP machine, the component devices stay "dirty", but when I do the same on an UP machine, the state is "clean". However, when I boot the SMP machine with "nosmp", or boot a non-SMP kernel, the problem persists. Both machines run a 2.6.0-test5 kernel (with your oops fix from 2003-09-12), and have mdadm-1.3.0.
This is the test script:
#!/bin/sh
dd bs=1024k count=10 if=/dev/zero of=/tmp/img1
dd bs=1024k count=10 if=/dev/zero of=/tmp/img2
losetup /dev/loop1 /tmp/img1
losetup /dev/loop2 /tmp/img2
mdadm -C -n 2 -l 1 /dev/md1 /dev/loop1 /dev/loop2
while grep resync /proc/mdstat
do sleep 1
done
echo done
sleep 3
mdadm -E /dev/loop1
mdadm -S /dev/md1
losetup -d /dev/loop1
losetup -d /dev/loop2
rm /tmp/img1
rm /tmp/img2
This is the output on the UP machine:
[======>..............] resync = 30.0% (3584/10176) finish=0.1min speed=716K/sec
done
/dev/loop1:
Magic : a92b4efc
Version : 00.90.00
UUID : 6553bca6:9c4152b1:960d65fc:75de3d79 Creation Time : Sat Sep 27 16:23:58 2003
Raid Level : raid1
Device Size : 10176 (9.94 MiB 10.42 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 1
Update Time : Sat Sep 27 16:24:11 2003
State : clean, no-errors
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Checksum : 35976528 - correct
Events : 0.1
Number Major Minor RaidDevice State
this 0 7 1 0 active sync /dev/loop1
0 0 7 1 0 active sync /dev/loop1
1 1 7 2 1 active sync /dev/loop2This is the output on the SMP machine:
[>....................] resync = 0.0% (0/10176) finish=1.6min speed=0K/sec
done
/dev/loop1:
Magic : a92b4efc
Version : 00.90.00
UUID : dc1e7844:0571f448:75ec8ac0:df235bed Creation Time : Sat Sep 27 16:23:18 2003
Raid Level : raid1
Device Size : 10176 (9.94 MiB 10.42 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 1
Update Time : Sat Sep 27 16:23:19 2003
State : dirty, no-errors
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Checksum : 5eb70538 - correct
Events : 0.1
Number Major Minor RaidDevice State
this 0 7 1 0 active sync /dev/loop1
0 0 7 1 0 active sync /dev/loop1
1 1 7 2 1 active sync /dev/loop2Signature · 3 lines
Dick Streefland //// De Bilt [email protected] (@ @) The Netherlands ------------------------------oOO--(_)--OOo------------------
[email protected] (Dick Streefland) wrote:
| I did some more tests, and it looks like my problem may be related to | SMP. When I setup a RAID1 array on my SMP machine, the component | devices stay "dirty", but when I do the same on an UP machine, the | state is "clean". However, when I boot the SMP machine with "nosmp", | or boot a non-SMP kernel, the problem persists. Both machines run a | 2.6.0-test5 kernel (with your oops fix from 2003-09-12), and have | mdadm-1.3.0.
It turns out that the problem is not related to SMP, but to CONFIG_PREEMPT. I built two identical kernels for a non-SMP machine, except for CONFIG_PREEMPT. With the CONFIG_PREEMPT kernel, the state is dirty, with the other kernel, the state is clean.
Signature · 3 lines
Dick Streefland //// De Bilt [email protected] (@ @) The Netherlands ------------------------------oOO--(_)--OOo------------------