检查发现几台服务器都存在raid定期同步的问题,每次同步的时间都一样:
[root@qht114 log]# cat messages
Sep 20 04:03:04 qht114 syslogd 1.4.1: restart.
Sep 20 04:22:01 qht114 kernel: md: syncing RAID array md0
Sep 20 04:22:01 qht114 kernel: md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc.
Sep 20 04:22:01 qht114 kernel: md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for reconstruction.
Sep 20 04:22:01 qht114 kernel: md: using 128k window, over a total of 104320 blocks.
Sep 20 04:22:01 qht114 kernel: md: delaying resync of md2 until md0 has finished resync (they share one or more physical units)
Sep 20 04:22:01 qht114 kernel: md: delaying resync of md3 until md0 has finished resync (they share one or more physical units)
Sep 20 04:22:01 qht114 kernel: md: delaying resync of md2 until md0 has finished resync (they share one or more physical units)
Sep 20 04:22:47 qht114 kernel: md: md0: sync done.
Sep 20 04:22:48 qht114 kernel: md: syncing RAID array md2
Sep 20 04:22:48 qht114 kernel: md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc.
Sep 20 04:22:48 qht114 kernel: md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for reconstruction.
Sep 20 04:22:48 qht114 kernel: RAID1 conf printout:
Sep 20 04:22:48 qht114 kernel: --- wd:2 rd:2
Sep 20 04:22:48 qht114 kernel: disk 0, wo:0, o:1, dev:hda1
Sep 20 04:22:48 qht114 kernel: md: using 128k window, over a total of 4192896 blocks.
Sep 20 04:22:48 qht114 kernel: disk 1, wo:0, o:1, dev:hdc1
Sep 20 04:22:48 qht114 kernel: md: delaying resync of md3 until md2 has finished resync (they share one or more physical units)
Sep 20 05:01:49 qht114 kernel: md: md2: sync done.
Sep 20 05:01:50 qht114 kernel: md: syncing RAID array md3
Sep 20 05:01:50 qht114 kernel: md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc.
Sep 20 05:01:50 qht114 kernel: md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for reconstruction.
Sep 20 05:01:50 qht114 kernel: md: using 128k window, over a total of 610349376 blocks.
Sep 20 05:01:50 qht114 kernel: RAID1 conf printout:
Sep 20 05:01:50 qht114 kernel: --- wd:2 rd:2
Sep 20 05:01:50 qht114 kernel: disk 0, wo:0, o:1, dev:hda3
Sep 20 05:01:50 qht114 kernel: disk 1, wo:0, o:1, dev:hdc3
[root@qht114 log]# vi messages.1
Sep 13 04:03:07 qht114 syslogd 1.4.1: restart.
Sep 13 04:22:01 qht114 kernel: md: syncing RAID array md0
Sep 13 04:22:01 qht114 kernel: md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc.
Sep 13 04:22:01 qht114 kernel: md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for reconstruction.
Sep 13 04:22:01 qht114 kernel: md: using 128k window, over a total of 104320 blocks.
Sep 13 04:22:01 qht114 kernel: md: delaying resync of md2 until md0 has finished resync (they share one or more physical units)
Sep 13 04:22:01 qht114 kernel: md: delaying resync of md3 until md0 has finished resync (they share one or more physical units)
Sep 13 04:22:01 qht114 kernel: md: delaying resync of md2 until md0 has finished resync (they share one or more physical units)
Sep 13 04:22:47 qht114 kernel: md: md0: sync done.
Sep 13 04:22:48 qht114 kernel: RAID1 conf printout:
Sep 13 04:22:48 qht114 kernel: md: delaying resync of md3 until md2 has finished resync (they share one or more physical units)
Sep 13 04:22:48 qht114 kernel: md: syncing RAID array md2
Sep 13 04:22:48 qht114 kernel: md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc.
Sep 13 04:22:48 qht114 kernel: md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for reconstruction.
Sep 13 04:22:48 qht114 kernel: --- wd:2 rd:2
Sep 13 04:22:48 qht114 kernel: md: using 128k window, over a total of 4192896 blocks.
Sep 13 04:22:48 qht114 kernel: disk 0, wo:0, o:1, dev:hda1
Sep 13 04:22:48 qht114 kernel: disk 1, wo:0, o:1, dev:hdc1
Sep 13 05:01:47 qht114 kernel: md: md2: sync done.
Sep 13 05:01:48 qht114 kernel: md: syncing RAID array md3
Sep 13 05:01:48 qht114 kernel: RAID1 conf printout:
Sep 13 05:01:48 qht114 kernel: md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc.
Sep 13 05:01:48 qht114 kernel: md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for reconstruction.
Sep 13 05:01:48 qht114 kernel: --- wd:2 rd:2
Sep 13 05:01:48 qht114 kernel: md: using 128k window, over a total of 610349376 blocks.
Sep 13 05:01:48 qht114 kernel: disk 0, wo:0, o:1, dev:hda3
Sep 13 05:01:48 qht114 kernel: disk 1, wo:0, o:1, dev:hdc3
Sep 17 21:07:00 qht114 kernel: md: md3: sync done.
Sep 17 21:07:00 qht114 kernel: RAID1 conf printout:
Sep 17 21:07:00 qht114 kernel: --- wd:2 rd:2
Sep 17 21:07:00 qht114 kernel: disk 0, wo:0, o:1, dev:hda5
Sep 17 21:07:00 qht114 kernel: disk 1, wo:0, o:1, dev:hdc5
Sep 18 20:20:01 qht114 auditd[2537]: Audit daemon rotating log files
syslog也是每周restart一次,这个是在logrotate控制的,这个和raid定期执行没有任何关系。
logrotate相关的介绍如下:
Linux日志切割工具Logrotate配置详解_服务器应用_Linux公社-Linux系统门户网站
raid定期同步是哪里定义的?
[root@qht113 etc]# crontab -l
crontab -l里面没有相关的命令,查看其它系统定义的定期任务:
[root@qht113 ~]# ls /etc/cron*
/etc/cron.deny /etc/crontab
/etc/cron.d:
dmeventd-logwatch mrtg sysstat
/etc/cron.daily:
0anacron cups makewhatis.cron prelink tmpwatch
0logwatch logrotate mlocate.cron rpm
/etc/cron.hourly:
mcelog.cron
/etc/cron.monthly:
0anacron
/etc/cron.weekly:
0anacron 99-raid-check makewhatis.cron
/etc/cron.weekly/99-raid-check就是我要找的定期脚本。
看一下具体执行的时间:
[root@qht113 init.d]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
每周的周日4点22分开始执行,和/var/log/message记录的时间点吻合。
所以不需要每周同步一次,将/etc/cron.weekly/99-raid-check移到/etc/cron.montyly每月同步一次。
最后重启下cron服务:
[root@qht113 log]# mv /etc/cron.weekly/99-raid-check /etc/cron.monthly/
[root@qht113 log]# /etc/init.d/crond restart
Stopping crond: [ OK ]
Starting crond: [ OK ]
另一种更加简单的方法:
修改 /etc/sysconfig/raid-check,将ENABLED=yes改成ENABLED=no就可以了,这样就可关闭自检。
# Note2: you can not use symbolic names for the raid devices, such as you
# /dev/md/root. The names used in this file must match the names seen in
# /proc/mdstat and in /sys/block.
ENABLED=yes
CHECK=check
# To check devs /dev/md0 and /dev/md3, use "md0 md3"
CHECK_DEVS=""
REPAIR_DEVS=""
SKIP_DEVS=""