2011年1月27日 星期四

Install NFS-utils 1.2.3 on Cent OS 5.5, in kernel 2.6.32.27

1.Start nfs kernel support
  File systems --->
  [*] Network File Systems --->
  <*> NFS server support
  [*] NFS server support for NFS version 3
  [*] NFS server support for the NFSv3 ACL protocol extension

  CONFIG_NFSD=y
  CONFIG_NFSD_V3=y
  CONFIG_NFSD_V3_ACL=y


2.Install need lib
  yum install nfs-utils-lib-devel.x86_64
  or
  wger http://www.monkey.org/~provos/libevent-2.0.10-stable.tar.gz
  tar zxf libevent-2.0.10-stable.tar.gz
  ./configure
  make && make install

3.Install NFS-utils
  wget http://downloads.sourceforge.net/project/nfs/nfs-utils/1.2.3/nfs-utils-1.2.3.tar.bz2
  tar zxf nfs-utils-1.2.3.tar.bz2
  ./configure --disable-tirpc --disable-gss
  make && make install

4.mount nfs filesystem
  mount -t rpc_pipefs sunpc /var/lib/nfs/rpc_pipefs
  mount -t nfsd nfsd /proc/fs/nfsd

5.Start nfs
  service nfs start

  If no error display on console, represent you success

Reference:
  http://www.arm9home.net/simple/index.php?t1543.html

mcelog: warning: record length longer than expected. Consider update.

常常會收到系統寄來的信
You have new mail in /var/spool/mail/root

而內容大部分是

/etc/cron.hourly/mcelog.cron:

mcelog: warning: record length longer than expected. Consider update.

發現是mcelog的問題

mcelog reports incorrect record size
http://elrepo.org/tiki/kernel-ml

Only 64-bit systems are affected. The userland tool needs to be revised to
distinguish between the mcelog record size of a distro kernel and a more
modern kernel. As a work-around to avoid hourly e-mail messsages from the
cron daemon, you can append 2>&1 to the last line of the
/etc/cron.hourly/mcelog.cron file.

See also: RHbz #507026 mcelog: warning: record length longer than expected.
(external link)
https://bugzilla.redhat.com/show_bug.cgi?id=507026


所以只要在/etc/cron.hourly/mcelog.cron這個檔案 最後一行加上2>&1就可以了

/usr/sbin/mcelog --ignorenodev --filter >> /var/log/mcelog 2>&1

2 為Console標準錯誤STDERR
1 為Console標準輸出STDOUT

STDIN,STDOUT,STDERR 即:0,1,2

2>&1 就是把 標準錯誤 重新導向到 標準輸出

參考
http://www.linuxsir.org/bbs/showthread.php?t=40501
http://www.ningoo.net/html/2007/shell_scripts_stderr_stdout.html

2011年1月26日 星期三

linux網路校正時間+解決無法同步硬體時間的問題

一般來說 要校正時間 只要

timeconfig
選定你的時區

ntpdate -s time.stdtime.gov.tw
網路校時

hwclock -w
寫入硬體


就完成了 但我發生了以下狀況

hwclock -w --debug
hwclock from util-linux-2.13-pre7
hwclock: Open of /dev/rtc failed, errno=19: No such device.
No usable clock interface found.
Cannot access the Hardware Clock via any known method.

表示RTC device有問題了

此時只要

mv /dev/rtc /dev/rtc.old
cp -a /dev/rtc0 /dev/rtc
hwclock --systohc
就可以成功的同步硬體時間了

但要先確定是否有/dev/rtc和/dev/rtc0

沒有的話就要重編kernel或掛載module開啟rtc

Device Drivers --->
   Real Time Clock --->
     RTC class
     Set system time from RTC on startup
     (rtc0) The RTC to read the time from

Reference:
http://lists.xensource.com/archives/html/xen-users/2010-08/msg00011.html
http://www.vixual.net/blog/archives/5