公告版位

# mkdir /mnt/cifs 

mount.cifs //192.168.1.1/file_dir /mnt/cifs -o username='myUsername',password='myPassword',codepage=cp950
(此指令為掛載)

or 

mount -t cifs //192.168.1.1/file_dir /mnt/cifs -o username='myUsername',password='myPassword',codepage=cp950
(此指令也是掛載) 

 

# umount /mnt/cifs
(此為取消掛載) 

dreamtails 發表在 痞客邦 留言(0) 人氣()

step1. # vim /etc/init.d/dhcpd

step2. 將daemon --pidfile=$pidfile $exec $DHCPDARGS 2>/dev/null 改成 daemon --pidfile=$pidfile $exec eth0 $DHCPDARGS 2>/dev/null
(主要是加上了eth0, 這樣一來,DHCP server在派送ip只會對這個interface(eth0)做,而不會對eth1做。這樣做的理由為假設兩張網卡為不同網段,這樣就可以避掉eth1這個網段的其他電腦來要ip) 

step3. # service dhcpd restart

 

資料來源:
1. http://go-linux.blogspot.com/2006/12/dhcp-server.html
2. http://www.csie.nctu.edu.tw/~tsaiwn/course/introcs/history/linux/linux.tnc.edu.tw/techdoc/dhcp.htm 

dreamtails 發表在 痞客邦 留言(0) 人氣()

由於工作需求,主管要我另起一台DNS server,但這台新的DNS server要把舊的DNS server資料全部copy過來,於是我參考了一些文章,自己來記錄一下過程!

step1: 在新的CentOS 5.5 安裝所需之packages
        # yum install bind-utils bind-chroot bind bind-libs 

step2: 先停止舊的DNS service
        # service named stop 

step3: 將舊的DNS server的/var/named/chroot下的var與etc目錄皆複製到新的CentOS的/var/named/chroot也就是要有以下這兩個目錄! 因為DNS主要的設定檔皆在裡面!
        - /var/named/chroot/var
        - /var/named/chroot/etc

step4: 啟動新的CentOS裡的DNS service,指令如下!
        # service named start 

 

參考資料來源:
1. http://blog.faq-book.com/?p=2969
2. http://linux.vbird.org/linux_basic/0580backup/0580backup-fc4.php
3. http://ithelp.ithome.com.tw/question/10072913 

dreamtails 發表在 痞客邦 留言(0) 人氣()

原來acpid daemon要啟動後,才有辦法在遠端用OpenIPMI下ipmitool指令去做power soft.不過,如果在BIOS下已開啟ACPI的話,就可以在BIOS的畫面直接下power soft.

dreamtails 發表在 痞客邦 留言(0) 人氣()

自己建來CentOS的LiveCD,裡面有詳細的教學https://projects.centos.org/trac/livecd/

網頁有地方有錯:請將「LANG=C livecd-creator --config=centos-livecd-desktop.ks --fslabel=CentOS-5.4--LiveCD」改成「LANG=C livecd-creator -c kickstart.ks -f LiveCD」

註:可使用livecd-iso-to-pxeboot指令將iso換成pxe可以吃的檔案!

dreamtails 發表在 痞客邦 留言(0) 人氣()

OpenIPMI command

Packages are OpenIPMI, OpenIPMI-tools, OpenIPMI-libs.

$ ipmitool -U username -P password -H 192.168.1.5 chassis power on
$ ipmitool -U username -P password -H 192.168.1.5 chassis power off
$ ipmitool -U username -P password -H 192.168.1.5 chassis power cycle
$ ipmitool -U username -P password -H 192.168.1.5 chassis power soft
$ ipmitool -U username -P password -H 192.168.1.5 chassis power status

$ ipmitool -U username -P password -H 192.168.1.5 chassis bootdev pxe
$ ipmitool -U username -P password -H 192.168.1.5 chassis bootdev bios
$ ipmitool -U username -P password -H 192.168.1.5 chassis bootdev disk

$ ipmitool -U username -P password -H 192.168.1.5 bmc info
$ ipmitool -U username -P password -H 192.168.1.5 lan print
$ ipmitool -U username -P password -H 192.168.1.5 lan set 1 ipsrc static
$ ipmitool -U username -P password -H 192.168.1.5 lan set 1 ipaddr 192.168.1.5
$ ipmitool -U username -P password -H 192.168.1.5 lan set 1 netmask 255.255.255.0
$ ipmitool -U username -P password -H 192.168.1.5 lan set 1 defgw ipaddr 192.168.1.254
$ ipmitool -U username -P password -H 192.168.1.5 mc info
$ ipmitool -U username -P password -H 192.168.1.5 mc reset cold

$ ipmitool -U username -P password -H 192.168.1.5 sdr
$ ipmitool -U username -P password -H 192.168.1.5 sel list

dreamtails 發表在 痞客邦 留言(0) 人氣()

ALPHA AGS-24X switch開關ports的方法:
$ config ports 1 state enable
$ config ports 1 state disable

ALPHA AGS-24X switch看ports狀態的方法:
$ show ports 1
$ sh ports 1

dreamtails 發表在 痞客邦 留言(0) 人氣()

uplink燈號:1G-switch跟10G-switch對接,1G-switch上的10G port燈號。

dreamtails 發表在 痞客邦 留言(0) 人氣()

core switch ping ip不通,但region switch ping ip會通,這可能是core switch沒設定"管理IP",而不表示core switch沒有在運作,因為switch只要通了電,它就已經在運作了,因此我們要用console線去接core switch看設定有沒有跑掉。若core switch不通,region switch也不通,那可能core switch真的掛掉了,所以還是要用console線去看看它的情況。

dreamtails 發表在 痞客邦 留言(0) 人氣()

smartctl看有關HDD資訊

看smart的log:
$ less /var/log/messages

看HDD是否支援S.M.A.R.T:
$ smartctl -i /dev/sda

若HDD有支援S.M.A.R.T,則啟動S.M.A.R.T功能:
$ smartctl -s on -d ata /dev/sda

看HDD支援哪些self-test routine,通常有short, conveyance與long三種self-test:
$ smartctl -c /dev/sda

使用long self-test routine取得較正確的結果(P.S. 一次只能執行一個測試):
$ smartctl -t long /dev/sda

smartctl不會顯示測試進度,但會回報這個測試要執行多久。等時間差不多後就確認測試進度:
$ smartctl -l selftest /dev/sda

看測試結果:
$ smartctl -a /dev/sda

看測試結果中,健康狀況的部份:
$ smartctl -H /dev/sda

看測試結果中,error log的部份:
$ smartctl -l error /dev/sda



請注意以下這一段:
===============================================
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
............
............
SMART Error Log Version: 1
No Errors Logged
===============================================

***若ID# 5、7、10、11、196~200這幾個項目的RAW_VALUE不為0,且持續增加,應立即備分並更換硬碟。

以上來源出自:http://sites.google.com/site/lab586/linuxnote/hddchecktip

dreamtails 發表在 痞客邦 留言(0) 人氣()

badblocks 指令檢測損壞磁區 (P.S. 讀寫次數龐大,常用會損害硬碟壽命)

語法:
badblocks [ -svwnf ] [ -b block-size ] [ -c blocks_at_once ] [ -e max_bad_blocks ] [ -d read_delay_factor ]
[-i input_file ] [ -o output_file ] [ -p num_passes ] [ -t test_pattern ] device [ last-block ] [ first-block ]

常用選項:
(default): non-destructive read-only mode 無損唯讀模式,較快。
-n: non-destructive read-write mode 無損讀寫模式,速度最慢。掛載中硬碟需加 -f 強制執行 (會有硬碟/檔案系統毀損的風險)
-w: destructive write test 毀滅性寫入測試。會將檔案全部抹銷!掛載中硬碟需加 -f 強制執行
-f: 強制執行,與 -n 或 -w 配合使用
-v: 執行中回報進度
-s: 將檢測出的壞磁區顯示在螢幕上
-i input_file: 略過不檢測 input_file 裡的已知 badblocks,這些已知 badblocks 同樣不會顯示在檢測結果中。
-o output_file: 將檢測出的 badblocks 寫在 output_file 上。

通常為求速度與資料安全,會使用預設的無損唯讀模式進行掃描。例如:
$ badblocks -v /dev/sda -o badblocks.txt

以上command為對 /dev/sda 進行無損唯讀模式掃描,-v 選項令 badblocks 在執行中回報進度,並以 -o 選項將檢測出的損壞磁區寫在 badblocks.txt 檔案裡。

dreamtails 發表在 痞客邦 留言(0) 人氣()

查詢Linux的版本與硬體資訊指令如下:

一.查詢Linux版本資訊
[root@mis~]# lsb_release -a
LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: CentOS
Description: CentOS release 5 (Final)
Release: 5
Codename: Final

二.查詢主機硬體資訊
[root@mis~]# dmidecode --type
Type number or keyword expected
Valid type keywords are:
bios
system
baseboard
chassis
processor
memory
cache
connector
slot

dmidecode下載與詳細說明網址:http://www.nongnu.org/dmidecode/

以上來源出自:http://jojochen.blog.ithome.com.tw/summary.php?op=UserProfile&userId=2530

dreamtails 發表在 痞客邦 留言(0) 人氣()

如何查詢Linux主機CPU, RAM與HDD硬體規格指令:


有兩種方式:

方式一:在/proc之下執行
$ cat cpuinfo
$ cat meminfo


方式二:執行指令
$ dmidecode -t processor
$ dmidecode -t memory

以上來源出自:http://jojochen.blog.ithome.com.tw/post/2529/63418


方式三:
$ grep -A 3 "model name" /proc/cpuinfo |egrep -v '(stepping|cache|--)'|awk -F: '{print $2}'
$ dmesg | grep "Memory:"
$ fdisk -l 2> /dev/null|grep '^Disk'
$ cat /proc/scsi/scsi

dreamtails 發表在 痞客邦 留言(0) 人氣()

Linux command for HDD:

[dd] 將硬碟直接備份到另外一顆硬碟
$ dd if=/dev/hda of=/dev/sda conv=noerror,sync bs=4k

[kill][killall] 查看DD的執行進度
$ kill -SIGUSR1 9218
# 9218 is PID
$ killall -SIGUSR dd編輯

dreamtails 發表在 痞客邦 留言(0) 人氣()

sed 指令:

$ cat string.txt|sed -n 20p
顯示第20列文字編輯

dreamtails 發表在 痞客邦 留言(0) 人氣()