寻觅生命中的那一片浅草......

每月存档 七月, 2010

域名解析检查工具

由于都是双线机房,所以域名解析要检查是否正确解析了电信IP,网通IP

同时还要检查IP是否可以ping通,为方便操作,写了个bat

代码如下:

@echo off
cls
color 1f
Title 检查域名解析
echo.
echo. 域名解析检查工具
echo. johncan
echo. 2010-07-27
echo.
echo.
echo ——————————————————————————-
echo.
set /p domain= 请输入要检查的域名:
echo.
for /f “delims=: tokens=1,2” %%i in (‘nslookup “%domain%”‘) do (
if /I “%%i”==”Address” (set “result=%%j”)
)
for /f “delims=: tokens=1,2” %%i in (‘nslookup “%domain%” 210.51.176.71’) do (
if /I “%%i”==”Address” (set “cnc_result=%%j”)
)

echo 域名: %domain%
echo 电信IP:%result%
echo 网通IP:%cnc_result%

echo.
echo.

echo ########## Ping %result% Result ##########
ping -n 10 %result%

echo.
echo.
echo ########## Ping %cnc_result% Result ##########
ping -n 10 %cnc_result%

echo.
echo.

echo 按任意键退出
pause >nul

[转]sing and dance

南方的午后阵雨持续扰乱着这原本就不平静的城市,校园里人来人往的喧嚣似乎想要证明这作为中国最美丽高校的魅力所在。很喜欢BBS上的一句话:这是中国最美丽的高校,没有之一。

同样地,最喜欢在雨天听的声音来自Sophie Zelmani,没有之一。

曾经在一段时间里十分欣赏王若琳,于是听了诸多这类型的歌,比如小野丽莎,比如Keren Ann 。。。。。。。,实在是没有把她们做比较的必要,也无所谓优劣,在于偏好。

可能中国的的听众会认识Sophie Zelmani,那么百分九十源于《sing and dance》这张专辑里的 going home 这首歌,因为王菲曾经翻唱了这首歌的中文版 “乘客”。这个来自瑞典这个北方国度的邻家女孩。她的歌词十分具有想象空间,却又不空洞,声音十分简单干净透澈却能直接触摸隐藏在心灵深处的纤纤情感。听她的歌就如同她就在你耳边细语,而述说的就是她的故事。 她的音乐风格十分清新,或清脆的吉他合弦衬托着她温暖甜美的歌声,或恰如其分不喧宾夺主的鼓与贝斯,陪衬上彷如远方传来的萨克司风及逐渐贴近的长笛或小提琴悠扬旋律,传递出彷佛在冷飕飕的秋天夜晚漫步走在瑞典已然结霜的路上,脚底还不时传出嘎吱细碎声响,那沁凉萧瑟绝美的意境,让人愈听愈沉醉其中难以自拔。总感觉北欧的冰冷也无法驱逐这个女孩声音带来的某种温暖。

听过她的几张专辑,但是《sing and dance》这张专辑里的 once 这首歌却轻易地将我俘虏了。听到once这首歌的时候,脑海中不禁浮现出这样的画面,一对老迈的夫妻,妻子已经濒危,躺在病床上,问自己的丈夫:我的脸是不是很皱了?丈夫轻柔地抚摸着妻子的满头白发,轻轻地说道:你仍像我当初见到你第一面那样美丽。此刻,生死的沉重竟然如此的云淡风轻。。。。。。

这是第一首sophie和男歌星的合唱。歌曲 轻柔低转,伴随着一如既往的木吉他声,将二人的声音衬托的更加突出.,传达出一种神奇的魔力。不但如此, 细读这首歌曲的歌词就会发现它的非凡之处。它不执著与伤感,,不陷于懊恼,,不流连于哀怨,通过一种哲学上最常用的问答形式,表达了一种对人生理性而超脱的思考。

Hey you
Can i breathe
If my chest is covered

Hey you
Is my face making sense

Eyes can’t be still
In a moment so tense

Here babe
Are the notes you must play
This babe, is the procedure

Here babe
Not in another way
I can assure you
That you will be okay

Once would do
Once could change everything
Once could tell
And help me to clear out
Some things
Once would make
No difference at all
Once or not
I’ve already made this fall

Hey you
Make the most of the time
You’ve got to cross many borders
If you can’t control your mind
Something will happen
It’s just a question of time

Oh babe
I can’t concentrate
I’m here for the wrong reason
It’s you who makes my knees shake
One season, then
The brakes are gonna break

转载自: http://zyzxmu1215.blog.163.com/blog/static/1631407752010514114418734/

http://zyzxmu1215.blog.163.com/blog/static/1631407752010514114418734/

编译内核及制作RPM包

一、前言
由于目前部分平台所使用的Linux发行版版本比较低,自带的内核版本远低于主流内核,无法使用到一些优秀的新内核特征,包括对我们比较有用的per-task storage I/O、改善在SMP系统中I/O的吞吐量、Ext4文件格式、虚拟化支持等。因此决定采用目前最新稳定版内核Linux-2.6.32.6(更新于2010-01-25)进行重新编译,生成一个更加小巧、稳定、安全、高效率的新内核。

二、编译步骤
第一步:

引用

# cd /home
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.32.5.tar.gz
# tar -zxvf linux-2.6.32.5.tar.gz -C /usr/src
# cd /usr/src
# ln -s linux-2.6.32.5 linux
# cd linux

第二步:

引用

# make mrproper (初次编译内核这步也可以省略,方便第二次编译初始用。)
# make menuconfig
# make bzImage && make modules && make modules_install(需30~40分钟,具体看服务器配置)
# make install

如需制作RPM内核安装包,运行以下命令,相当于第二步的操作,但不编译本机内核。

补充:在make rpm前,需要保证系统上有rpmbuild命令
#yum -y install rpm-build

# make rpm
生成位置:
/usr/src/redhat/RPMS/x86_64/kernel-2.6.32.6-2.x86_64.rpm
/usr/src/redhat/SRPMS/kernel-2.6.32.6-2.src.rpm

三、安装步骤
1、二进制rpm包安装步骤
# rpm -ivh kernel-2.6.32.6-1.x86_64.rpm
# vi /boot/grub/menu.lst添加以下并修改default项。

引用

title CentOS (2.6.32.6)
root (hd0,0)
kernel /vmlinuz-2.6.32.6 ro root=LABEL=/
initrd /initrd-2.6.32.6.img

# cd /lib/modules && mkinitrd /boot/initrd-2.6.32.6.img 2.6.32.6/
2、RPM源码包安装步骤,好处便是在原有基础上再进行编译,更灵活。

引用

# rpm -Uvh kernel-2.6.32.6-2.src.rpm
# rpmbuild -bp –target=$(arch) /usr/src/redhat/SPECS/kernel-2.6.32.6-2.spec
# cd /usr/src/redhat/BUILD/kernel-2.6.32.6-2
# vi Makefile <– Change “EXTRAVERSION” to avoid kernel overwriting
# cp /lib/modules/2.6.32.6/build/.config .
# make menuconfig
# 重复第二步

四、ChangeLog

引用

2.1、裁减了51M内核模块,目前大小为46M。
2.2、No Forced Preemption(Server)适合服务器环境的禁止内核抢占。
2.3、High Memory Support->64GB。
2.4、Default I/O scheduer(Deadline)使用Deadline作硬盘存取排程器,非常适合IO较大的数 据库服务器。
2.5、添加Ext4 FileSystem。
2.6、删除Dell laptop support、Toshiba Laptop support。
2.7、开启Netfilter支持。
2.8、Export task/process statistics through netlink(sys task相关选项)。
2.9、Enable extended accounting over taskstats(sys task相关选项)。
2.10、Enable per-task storage I/O accounting(sys task相关选项)。
2.11、Support for Large Block Devices (LBD) – 支持超过 2TB 大小的储存设备。
2.12、Support for Large Single Files (LSF) – 支持处理超过 2TB 大小的文件
2.13、裁减sound card support。
2.14、裁减Bluetooth subsystem support。
2.15、裁减Wireless。
2.16、裁减Kernel hacking 。

如需编译后的RPM包请联系我(文件太大,不好传)。
kernel-2.6.32.6-2.x86_64.rpm(17M)
kernel-2.6.32.6-2.src.rpm(84M)

转载自:http://blog.liuts.com/post/180/

Linux 系统死机怎么办?

06.9.21

http://lopsa.org/pipermail/discuss/2006-January/000670.html

1. Flash upgrading BIOS of RAID controllers
2. Replacement of RAID controller cards (both of them)
3. Moving RAID cards to different PCI slots
4. Monitored temperatures via lm_sensors until a lockup to verify no heat
problems
5. Removal of unncessary kernel modules (USB, pcmcia, etc)
6. Disabling of APIC in BIOS
7. Adjustment of IOMMU memory apeture hole size in BIOS
8. Booting with various combinations of kernel parameters “noapic”,
“acpi=0″, “nmi_watchdog=1″
9. Various kernels including minimal custom compiled ones
10. full fsck bad blocks check of each individual hard disk in the arrays
(took 2.x days)
11. Discontinued usage of eth0 as it seemed to be on same interrupt as one
of the RAID controllers.
12. Stood on one foot while rebooting, while simultaneously sacrificing a
chicken and burning a copy of MS-Windows (okay not really but if it would
fix it I would do it!).
13. A full flogging with memtest, although I am skeptical that this is the
problem…the RAM is ECC and the problem seems to be caused from a specific
IO pattern.
14. Installing and booting a non-SMP kernel (I’ve read of similar problems
when using the non smp 3ware driver in an SMP system….I doubt this is the
answer either as I have tried custom compiled kernels without any luck)

06.9.10

很多时候,客户现场很恶劣,没有机会进行内核调试,或者最多给你一次修正的机会,要么搞定,要么走人,这种情况下该如何是好呢?只能靠“平时积累+运气”了,无法控制运气,不过还是有办法增加积累的,比如及时跟踪内核的进展、阅读redhat, suse, kernel.org的bugzilla等。

06.7.30

使用netconsole可以把内核信息通过网络传输到另一台机器上,也就是说把另一台机器的某个UPD端口作为内核信息输出的对象(比如发送到远端的syslog中)。很容易设置,具体用法见:
/usr/src/linux/Documentation/networking/netconsole.txt

关于串口console的设置,可以参考的这篇Dave Jones的这篇blog:
http://kernelslacker.livejournal.com/42428.html

05.12.18

死机后应做的一些设置,以便死机再次发生时能多少获得些信息:

# turn off tty blackout
# setterm -blank 0

# turn on magical sysrq
# sysctl -w kernel.sysrq=1

# please do NOT reboot when panic happened
# sysctl -w kernel.panic=0

# please do NOT reboot when oops happened
# sysctl -w kernel.panic_on_oops=0

05.12.17

some references:

  • https://bugzilla.novell.com/bugreporting-faq/oops-reading.txt
  • https://bugzilla.novell.com/bugreporting-faq/kernel-debugging-intro.txt
  • http://kerneltrap.org/node/3648

05.01.24

今天听说 SUN 要公开他的 DTrace (http://www.osnews.com/story.php?news_id=9480),虽然还没有看到,感觉应该是一个很有用的系统分析和调优工具,不过只支持 solaris。不知和 LKST 有什么区别。expecting…

05.01.13
如果问题能够再现,那么问题已经解决 80% 了。对于操作系统核心而言,如果有问题的再现方法,那么可以说是已经解决 99% 了。经常遇到的问题是系统可以正常运行一段时间,然后死机。如果不好再现问题,那么只有根据死机现场遗留的东西来进行分析了。

如果系统没有死干净,比如磁盘中断和文件系统是好的,那么也许能有日志信息保留在文件中,不过这样的好运气我是从来没有遇到过的。如果键盘中断还能响应 (按下 Num Lock,可以看见键盘小灯亮灭),那么运气就算是足够好了,这时可以祭出 sysrq 大法,同时按下 Alt-Sysrq-T 获得进程系统堆栈信息,按下 Alt-Sysrq-M 获得内存分配信息,按下 Alt-Sysrq-W 获得当前寄存器信息… 详见 linux/Documentation/sysrq.txt。另外,最好关闭终端的自动 blank 功能,这样系统死的时候至少能从屏幕上看到一些信息。设置方法是:

# echo 1 > /proc/sys/kernel/sysrq
# setterm -blank

这两个设置最好加到系统启动脚本中 (比如 /etc/rc.d/rc.local),保证每次启动都能得到运行。

如果很不幸,键盘也死悄悄了,(更为不幸的是,这种情况很常见),那么也不是只有等死一个办法,这时可以用串口终端 (serial console)将系统信息发送到另一台系统上,这样可以通过对这些信息分析来定位问题。设置方法如下:

——————————————————————————
准备工作
1. 一台被监视的服务器,一台进行监视工作的PC。
2. 一根串口直连线。

配置
1. 在服务器上,加入一个新的 grub 项目,增加核心参数 “console=ttyS0 console=tty1″,如:
kernel /boot/vmlinuz-2.4.21-9.30AXsmp ro root=LABEL=/1 console=ttyS0 console=tty1

2. 在服务器上,修改 /etc/sysconfig/syslog,加入 klogd 选项 “-c 7″,保证更多内核信息得到输出。如:
KLOGD_OPTIONS=”-x -c 7″

3. 重新启动服务器

4. 用串口直连线连接两台机器,测试:
1) 在PC上运行 “cat /dev/ttyS0″,在服务器上运行 “echo hi > /dev/ttyS0″,看在 PC 上是否有 “hi” 输出。
2) 在PC上运行 “cat /dev/ttyS0″,在服务器上运行 “echo w > /proc/sysrq-trigger”,看 PC 上是否有相应内核信息输出。
3) 在PC上运行 “cat /dev/ttyS0″,在服务器上运行 “modprobe loop”,看 PC 上是否有相应内核信息输出。

5. 如果测试通过,那么在 PC 上运行:
cat /dev/ttyS0 | tee /tmp/result

另外,也可以用 Windows 超级终端获得串口信息。

that’s it.
——————————————————————————

此外,一些核心支持 LKCD, netdump 等调试功能,也可以一试。

剩下的,就只有靠经验和运气了,一般造成 Linux 系统死机的原因有:

  • 系统硬件问题 (SCSI 卡,主板,RAID 卡,网卡,硬盘…)
  • 外围硬件问题 (终端切换器,网络…)
  • 软件问题
    • 驱动 bug (去找更新的驱动试试)
    • 核心系统 bug (去 LKML 上看看,或换个核心试试)
    • 系统设置

最后,google一把。有时候你可以直接输入 “Linux 系统死机怎么办?” 或者 “我的运行 Red Flag Server 2.1 的 Dell PE6650 经常死机”,看有没有人遇到过和你同样的问题。即使没有找到,也是一个有助于分析问题的信息,至少说明你的系统可能有和其他人不同之处。

调查 Linux 系统死机问题,这既是科学又是艺术,牵扯到众多的硬件软件知识和经验,是一个不断学习的过程,同样,我也会不断更新这篇东西的。

——————————-
05.3.25

当然,需要补充的是,有些时候不是OS的问题,如何判断是否为硬件错误呢?

A number of bugs get reported that really don’t make a lot of sense.
The cause all sorts of head-scratching among kernel developers.
Whilst most bug-reporters don’t like to hear that their shiny new
hardware may be broken/crap, sadly this is the case sometimes.
Here’s a few tips that may help root-cause hardware problems.- Use the CPU clock speed that the CPU was rated for.
Don’t overclock. Don’t overclock. Don’t overclock.
Even if Windows XP works fine on your 6GHz water-cooled Pentium4,
this is no sign of stability. In some cases Linux can push the
theoretical limits of the machine (by utilising all available
memory bandwidth for sustained periods of time for example).
Under such extreme load, the CPU will be generating a lot more
heat than it will sitting idle on a Windows XP desktop.

– Make sure your power supply is adequate to power all the peripherals
you have attached. The gotcha here is that whilst it may be adequate
to get the OS booted, when it’s actually doing some work
(like a big compile, or running doom), it’s going to use up more
power than it would whilst idling. All of this power has to come
from somewhere. If the PSU can’t supply enough, something is going
to be underpowered, which can result in very strange kernel panics.

– memtest86
Yes it takes ages to run. Sometimes it takes at least a day
before it shows up that there’s a bit error in some DIMM.
It’s really worth the time testing though. If you don’t do this
test, and the problem really is flaky RAM, then the ‘bug’ will
never be fixed.

– Reset BIOS to safe defaults.
A number of times, users have reported issues that manifest themselves
as really obscure oopses that don’t really make a lot of sense.
They turned out to be things like ‘CAS timing’ set too aggressive
on systems with cheap RAM.
(A number of times, these settings worked fine until the user
added an extra DIMM). Interestingly, this problem didn’t show up
under memtest86 [although maybe it would if left to run long enough]

– Check cabling isn’t obscuring airflow.
Fans should be completely unobstructed, ensuring that air can circulate
throughout the case.

转载自:http://baoz.net/linux-%e7%b3%bb%e7%bb%9f%e6%ad%bb%e6%9c%ba%e6%80%8e%e4%b9%88%e5%8a%9e%ef%bc%9f/

About Learning Linux

Sometimes,my friends ask me how to learn Linux.They want me to recommend them some books and some other study materials.

I think the following two books are very good study material.The first one make you know what Linux is. The second one make you know what can Linux do.Of course, you must do more experiments which mentioned in the books.

1. LINUX:THE TEXTBOOK
http://product.dangdang.com/product.aspx?product_id=9007683&ref=search-1-A

2. 鸟哥的Linux私房菜服务器架设篇(第二版)(附光盘)
http://product.dangdang.com/product.aspx?product_id=20076149&ref=book-02-L

At last, I suggest you build a linux from code source using “Linux From Scratch”. This distribution version’s offical website is http://www.linuxfromscratch.org/ .The easy install document is http://www.linuxsir.org/bbs/thread322894.html

2010年七月
« 6月   8月 »
 1234
567891011
12131415161718
19202122232425
262728293031