hi all,
All this while, I have been struggling with the iwlwifi kernel module working with my Intel wireless card, Centrino Wireless-N 1000 [Condor Peak]. It always having the kernel initialization errors and/or having the wireless connectivity intermittent. There are many posts out in the internet about to remedy this problem. But, none of them are working for me, until I upgraded my OS to Linux Mint 16, Petra with a little bit of tweaks. So, I would like to take this opportunity to list down all the changes in order to make it works.
1. I have blacklisted my bluetooth driver. It is always rare to use and this bluetooth kernel is always fighting with the iwldvm module to initialize the hardware. So, I decided to blacklist it.
tehtarik ~ # tail -n2 /etc/modprobe.d/blacklist.conf
# Hiu added this
blacklist bluetooth
2. I have taken out all of the unrelated intel wireless firmware. For more details you can refer it to http://wireless.kernel.org/en/users/Drivers/iwlwifi. I know my firmware is /lib/firmware/iwlwifi-1000-5.ucode. So, I purposely taken out the rest of the intel firmware and move them under my /root directory like this.
tehtarik ~ # ls -al /root/iwlwifi/
total 8068
drwxr-xr-x 2 root root 4096 Dec 1 22:23 .
drwx------ 12 root root 4096 Dec 13 00:53 ..
-rw-r--r-- 1 root root 337572 Apr 25 2013 iwlwifi-100-5.ucode
-rw-r--r-- 1 root root 689680 Apr 25 2013 iwlwifi-105-6.ucode
-rw-r--r-- 1 root root 701228 Apr 25 2013 iwlwifi-135-6.ucode
-rw-r--r-- 1 root root 695876 Apr 25 2013 iwlwifi-2000-6.ucode
-rw-r--r-- 1 root root 707392 Apr 25 2013 iwlwifi-2030-6.ucode
-rw-r--r-- 1 root root 670172 Jul 10 22:59 iwlwifi-3160-7.ucode
-rw-r--r-- 1 root root 150100 Apr 25 2013 iwlwifi-3945-2.ucode
-rw-r--r-- 1 root root 187972 Apr 25 2013 iwlwifi-4965-2.ucode
-rw-r--r-- 1 root root 340696 Sep 30 22:33 iwlwifi-5000-5.ucode
-rw-r--r-- 1 root root 337400 Apr 25 2013 iwlwifi-5150-2.ucode
-rw-r--r-- 1 root root 454608 Apr 25 2013 iwlwifi-6000-4.ucode
-rw-r--r-- 1 root root 444128 Apr 25 2013 iwlwifi-6000g2a-5.ucode
-rw-r--r-- 1 root root 677296 Apr 25 2013 iwlwifi-6000g2a-6.ucode
-rw-r--r-- 1 root root 679436 Apr 25 2013 iwlwifi-6000g2b-6.ucode
-rw-r--r-- 1 root root 469780 Apr 25 2013 iwlwifi-6050-5.ucode
-rw-r--r-- 1 root root 682892 Jul 10 22:59 iwlwifi-7260-7.ucode
3. I have put some of the important kernel parameter tweaks of iwlwifi. Here is how it is look like. This line is really important: options iwlwifi 11n_disable=1 bt_coex_active=0. Actually, there are many people are documenting the same tweaks on this kernel module. But, for me these are the mostly important tweaks and you must have it.
tehtarik ~ # cat /etc/modprobe.d/iwlwifi.conf
# /etc/modprobe.d/iwlwifi.conf
# iwlwifi will dyamically load either iwldvm or iwlmvm depending on the
# microcode file installed on the system. When removing iwlwifi, first
# remove the iwl?vm module and then iwlwifi.
remove iwlwifi \
(/sbin/lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs /sbin/rmmod) \
&& /sbin/modprobe -r mac80211
options iwlwifi 11n_disable=1 bt_coex_active=0
With all the steps applied onto my laptop, I don't have any more wireless connectivity hiccup and happily ever after. I don't need to figure out the alternative way of configuring the ndiswrapper or buying another external usb wireless adapter. Hope it helps you all.
Thanks.
Thursday, December 12, 2013
Monday, November 4, 2013
Python in Action: ssh paramiko client - first release to github
I have been working on the same codes for almost a week from now. I feel that I am more comfortable with the output and I decided to push it over to github and hope that it could help others system engineer who needed to do the automation with a large group of servers/VMs. You can clone the codes from here.
Here is the output that you will be getting.
hiuy@nasilemak ~/ssh-paramiko-client $ ./pyssh.py
Password:
-- Welcome to ssh paramiko --
ssh > help
Usage - pyssh.py
addhost - add host with the comma delimitter
addhostfile - add host with a absolute path of a file
rmhost - remove host with the comma delimitter
lshost - list hosts
ping - do a ping test to the added host list
connect - establish ssh connection to the added host list
run - run a specific command on the connected host
close - close the ssh connect to the added host list
quit - quit the session
ssh > addhost centos64-1, centos64-2
host added: ['centos64-1', 'centos64-2']
ssh > ping
host centos64-1 PING OK
host centos64-2 PING OK
ssh > connect
Connected host: centos64-1
Connected host: centos64-2
Total connected hosts: 2 out of 2
ssh > run uptime
host: centos64-1
05:49:07 up 4:24, 1 user, load average: 0.00, 0.10, 0.10
host: centos64-2
05:49:07 up 4:25, 1 user, load average: 0.00, 0.00, 0.00
ssh > run uname -a
host: centos64-1
Linux localhost.localdomain 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed Oct 16 18:37:12 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
host: centos64-2
Linux localhost.localdomain 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed Oct 16 18:37:12 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
ssh > run rpm -qa | grep kernel
host: centos64-1
kernel-devel-2.6.32-358.el6.x86_64
kernel-headers-2.6.32-358.23.2.el6.x86_64
abrt-addon-kerneloops-2.0.8-16.el6.centos.1.x86_64
dracut-kernel-004-303.el6.noarch
libreport-plugin-kerneloops-2.0.9-15.el6.centos.1.x86_64
kernel-firmware-2.6.32-358.23.2.el6.noarch
kernel-devel-2.6.32-358.23.2.el6.x86_64
kernel-2.6.32-358.el6.x86_64
kernel-2.6.32-358.23.2.el6.x86_64
host: centos64-2
kernel-devel-2.6.32-358.el6.x86_64
kernel-headers-2.6.32-358.23.2.el6.x86_64
abrt-addon-kerneloops-2.0.8-16.el6.centos.1.x86_64
dracut-kernel-004-303.el6.noarch
libreport-plugin-kerneloops-2.0.9-15.el6.centos.1.x86_64
kernel-firmware-2.6.32-358.23.2.el6.noarch
kernel-devel-2.6.32-358.23.2.el6.x86_64
kernel-2.6.32-358.el6.x86_64
kernel-2.6.32-358.23.2.el6.x86_64
ssh > close
ssh > quit
hiuy@nasilemak ~/ssh-paramiko-client $
If you are keen to develop and contribute to this codes, please drop me an email, and we can work it out together. All of the new ideas are mostly welcome. Thanks.
Here is the output that you will be getting.
hiuy@nasilemak ~/ssh-paramiko-client $ ./pyssh.py
Password:
-- Welcome to ssh paramiko --
ssh > help
Usage - pyssh.py
addhost - add host with the comma delimitter
addhostfile - add host with a absolute path of a file
rmhost - remove host with the comma delimitter
lshost - list hosts
ping - do a ping test to the added host list
connect - establish ssh connection to the added host list
run - run a specific command on the connected host
close - close the ssh connect to the added host list
quit - quit the session
ssh > addhost centos64-1, centos64-2
host added: ['centos64-1', 'centos64-2']
ssh > ping
host centos64-1 PING OK
host centos64-2 PING OK
ssh > connect
Connected host: centos64-1
Connected host: centos64-2
Total connected hosts: 2 out of 2
ssh > run uptime
host: centos64-1
05:49:07 up 4:24, 1 user, load average: 0.00, 0.10, 0.10
host: centos64-2
05:49:07 up 4:25, 1 user, load average: 0.00, 0.00, 0.00
ssh > run uname -a
host: centos64-1
Linux localhost.localdomain 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed Oct 16 18:37:12 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
host: centos64-2
Linux localhost.localdomain 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed Oct 16 18:37:12 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
ssh > run rpm -qa | grep kernel
host: centos64-1
kernel-devel-2.6.32-358.el6.x86_64
kernel-headers-2.6.32-358.23.2.el6.x86_64
abrt-addon-kerneloops-2.0.8-16.el6.centos.1.x86_64
dracut-kernel-004-303.el6.noarch
libreport-plugin-kerneloops-2.0.9-15.el6.centos.1.x86_64
kernel-firmware-2.6.32-358.23.2.el6.noarch
kernel-devel-2.6.32-358.23.2.el6.x86_64
kernel-2.6.32-358.el6.x86_64
kernel-2.6.32-358.23.2.el6.x86_64
host: centos64-2
kernel-devel-2.6.32-358.el6.x86_64
kernel-headers-2.6.32-358.23.2.el6.x86_64
abrt-addon-kerneloops-2.0.8-16.el6.centos.1.x86_64
dracut-kernel-004-303.el6.noarch
libreport-plugin-kerneloops-2.0.9-15.el6.centos.1.x86_64
kernel-firmware-2.6.32-358.23.2.el6.noarch
kernel-devel-2.6.32-358.23.2.el6.x86_64
kernel-2.6.32-358.el6.x86_64
kernel-2.6.32-358.23.2.el6.x86_64
ssh > close
ssh > quit
hiuy@nasilemak ~/ssh-paramiko-client $
If you are keen to develop and contribute to this codes, please drop me an email, and we can work it out together. All of the new ideas are mostly welcome. Thanks.
Sunday, November 3, 2013
visudo: Are you really a joker?
What you see sometimes doesn't mean what you think!
I just came across a funny configuration bits on the /etc/sudoers file lately on centos64. The default configuration for /etc/sudoers comes with this (the last 2 lines at the config). Okay, gentlemen. Please pay attention with this. If you would be creating a directory like /etc/sudoers.d/, then basically you are asking sudoer to look at any of the small snippets with in it, or what they called it as drop-in files. Make sure you do have the snippet and stay within this directory. Otherwise, your visudo -c -f /etc/sudoers will complain and shout at you when you save it.
What is make me laugh at it was the syntax of the configuration #includedir. It is telling you that it has been turned on. Don't be fooled because it was commented out (as usual, a sys admin will think the same across, further more most of the tags was commented out). It *doesnt* mean what you think. So, watch out! It bites you!
## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
I just came across a funny configuration bits on the /etc/sudoers file lately on centos64. The default configuration for /etc/sudoers comes with this (the last 2 lines at the config). Okay, gentlemen. Please pay attention with this. If you would be creating a directory like /etc/sudoers.d/, then basically you are asking sudoer to look at any of the small snippets with in it, or what they called it as drop-in files. Make sure you do have the snippet and stay within this directory. Otherwise, your visudo -c -f /etc/sudoers will complain and shout at you when you save it.
What is make me laugh at it was the syntax of the configuration #includedir. It is telling you that it has been turned on. Don't be fooled because it was commented out (as usual, a sys admin will think the same across, further more most of the tags was commented out). It *doesnt* mean what you think. So, watch out! It bites you!
## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
Monday, October 21, 2013
Python in Action: Paramiko handling ssh connection
I came across the ssh interactive session from bash long time ago using the expect. But, this morning I am exploring paramiko, and start to draft a stupid easy codes to test out the library. It is clean and blazing fast. Hope this small chunks of codes can get you started with all the complicated paramiko codes.
#!/usr/bin/python
import os
import paramiko
import getpass
user=os.getlogin()
print "Connecting via %s: what is your password?" % user
pw = getpass.getpass()
ssh = paramiko.SSHClient()
#ssh.load_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('centos64-1', username=user, password=pw)
stdin, stdout, stderr = ssh.exec_command('uname -a')
print "output", stdout.read()
ssh.close()
After a day so, I feel like I want to do a little of enhancement out of it. So, I recode it something like below. Still feeling it is not as neath as I love to. But, overall it can carry out the work.
#!/usr/bin/python
import os
import paramiko
import getpass
import socket
def get_credential():
user=os.getlogin()
print "Connecting via [%s]: what is your password?" % user
pw = getpass.getpass()
return (user, pw)
def ssh_connect():
(user, pw) = get_credential()
try:
ssh = paramiko.SSHClient()
#ssh.load_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('centos64-1', username=user, password=pw)
stdin, stdout, stderr = ssh.exec_command('uname -a')
print "output: ", stdout.read()
ssh.close()
except paramiko.SSHException, e:
print "Password is invalid:" , e
except paramiko.AuthenticationException:
print "Authentication failed for some reason"
except socket.error, e:
print "Socket connection failed:", e
def main():
ssh_connect()
if __name__ == '__main__':
main()
After a day so, I have done some polishing on the same codes. Now, it can accept a list of target hosts with a comma delimiter. Then, the script will be connecting to target hosts one by one. Feel free to copy/use it. Thanks!
#!/usr/bin/python
import os
import paramiko
import getpass
import socket
def get_host():
target_host = []
input = raw_input("What is your target host? ")
for item in input.split(","):
target_host.append(item.strip())
return target_host
def get_credential():
pw = ""
user=os.getlogin()
print "Connecting via [%s]: what is your password?" % user
while not pw:
pw = getpass.getpass()
return (user, pw)
def ssh_connect():
target_host = get_host()
(user, pw) = get_credential()
ssh = paramiko.SSHClient()
#ssh.load_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
for h in target_host:
try:
print "Connecting to %s ..." % h
ssh.connect(h, username=user, password=pw)
stdin, stdout, stderr = ssh.exec_command('uname -a')
print "%s>" % h,stdout.read()
except paramiko.SSHException, e:
print "Password is invalid:" , e
except paramiko.AuthenticationException:
print "Authentication failed for some reason"
except socket.error, e:
print "Socket connection failed on %s:" % h, e
ssh.close()
def main():
ssh_connect()
if __name__ == '__main__':
main()
Here is the output that I got.
hiuy@nasilemak ~ $ ./pyssh.py
What is your target host? centos64-1, centos64-2
Connecting via [hiuy]: what is your password?
Password:
Connecting to centos64-1 ...
centos64-1> Linux centos64-1.hiu.com 2.6.32-358.18.1.el6.x86_64 #1 SMP Wed Aug 28 17:19:38 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Connecting to centos64-2 ...
centos64-2> Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
#!/usr/bin/python
import os
import paramiko
import getpass
user=os.getlogin()
print "Connecting via %s: what is your password?" % user
pw = getpass.getpass()
ssh = paramiko.SSHClient()
#ssh.load_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('centos64-1', username=user, password=pw)
stdin, stdout, stderr = ssh.exec_command('uname -a')
print "output", stdout.read()
ssh.close()
After a day so, I feel like I want to do a little of enhancement out of it. So, I recode it something like below. Still feeling it is not as neath as I love to. But, overall it can carry out the work.
#!/usr/bin/python
import os
import paramiko
import getpass
import socket
def get_credential():
user=os.getlogin()
print "Connecting via [%s]: what is your password?" % user
pw = getpass.getpass()
return (user, pw)
def ssh_connect():
(user, pw) = get_credential()
try:
ssh = paramiko.SSHClient()
#ssh.load_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('centos64-1', username=user, password=pw)
stdin, stdout, stderr = ssh.exec_command('uname -a')
print "output: ", stdout.read()
ssh.close()
except paramiko.SSHException, e:
print "Password is invalid:" , e
except paramiko.AuthenticationException:
print "Authentication failed for some reason"
except socket.error, e:
print "Socket connection failed:", e
def main():
ssh_connect()
if __name__ == '__main__':
main()
After a day so, I have done some polishing on the same codes. Now, it can accept a list of target hosts with a comma delimiter. Then, the script will be connecting to target hosts one by one. Feel free to copy/use it. Thanks!
#!/usr/bin/python
import os
import paramiko
import getpass
import socket
def get_host():
target_host = []
input = raw_input("What is your target host? ")
for item in input.split(","):
target_host.append(item.strip())
return target_host
def get_credential():
pw = ""
user=os.getlogin()
print "Connecting via [%s]: what is your password?" % user
while not pw:
pw = getpass.getpass()
return (user, pw)
def ssh_connect():
target_host = get_host()
(user, pw) = get_credential()
ssh = paramiko.SSHClient()
#ssh.load_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
for h in target_host:
try:
print "Connecting to %s ..." % h
ssh.connect(h, username=user, password=pw)
stdin, stdout, stderr = ssh.exec_command('uname -a')
print "%s>" % h,stdout.read()
except paramiko.SSHException, e:
print "Password is invalid:" , e
except paramiko.AuthenticationException:
print "Authentication failed for some reason"
except socket.error, e:
print "Socket connection failed on %s:" % h, e
ssh.close()
def main():
ssh_connect()
if __name__ == '__main__':
main()
Here is the output that I got.
hiuy@nasilemak ~ $ ./pyssh.py
What is your target host? centos64-1, centos64-2
Connecting via [hiuy]: what is your password?
Password:
Connecting to centos64-1 ...
centos64-1> Linux centos64-1.hiu.com 2.6.32-358.18.1.el6.x86_64 #1 SMP Wed Aug 28 17:19:38 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Connecting to centos64-2 ...
centos64-2> Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Thursday, October 10, 2013
Script to report the HBA cards status
I have a small function to detect the emulex, and qlogic HBA cards for a quick one. If you find it useful in your automation you can embed this function to your script and start calling it. Hope that it helps you in your works. Thanks!
function check_hba ()
{
# Checking Emulex HBA cards status
if grep -q -i "online" /sys/class/fc_host/host*/port_state 2>/dev/null
then
num_online_hba=`grep -i "online" /sys/class/fc_host/host*/port_state | wc -l`
total_hbas=`ls -1 /sys/class/fc_host/host*/node_name | wc -l`
echo "Linux discovered $num_online_hba HBAs is online out of $total_hbas cards."
for h in `ls -1 /sys/class/fc_host/host*/node_name | awk -F/ '{print $5}'`
do
wwn=`cat /sys/class/fc_host/$h/port_name`
state=`cat /sys/class/fc_host/$h/port_state`
#modelname=`cat /sys/class/scsi_host/$h/modelname`
#echo "HBA $modelname : $wwn is $state"
echo "HBA : $wwn is $state"
done
fi
# Checking Qlogic HBA cards status
if grep -q -i "ready" /proc/scsi/qla2xxx/* 2>/dev/null
then
total_hbas=`ls -1 /proc/scsi/qla2xxx/* | wc -l`
num_online_hba=`grep -i "ready" /proc/scsi/qla2xxx/*| wc -l`
echo "Linux discovered $num_online_hba is online out of $total_hbas cards."
for h in `ls -1 /proc/scsi/qla2xxx/*`
do
wwn=`cat $h|grep "scsi-qla.-adapter-port*" | awk -F= '{print $2}' | sed -e 's|;||g'`
grep -i -q "Host adapter.*ready" $h && echo "HBA : $wwn is Online" || echo "HBA : $wwn is Offline"
done
fi
}
function check_hba ()
{
# Checking Emulex HBA cards status
if grep -q -i "online" /sys/class/fc_host/host*/port_state 2>/dev/null
then
num_online_hba=`grep -i "online" /sys/class/fc_host/host*/port_state | wc -l`
total_hbas=`ls -1 /sys/class/fc_host/host*/node_name | wc -l`
echo "Linux discovered $num_online_hba HBAs is online out of $total_hbas cards."
for h in `ls -1 /sys/class/fc_host/host*/node_name | awk -F/ '{print $5}'`
do
wwn=`cat /sys/class/fc_host/$h/port_name`
state=`cat /sys/class/fc_host/$h/port_state`
#modelname=`cat /sys/class/scsi_host/$h/modelname`
#echo "HBA $modelname : $wwn is $state"
echo "HBA : $wwn is $state"
done
fi
# Checking Qlogic HBA cards status
if grep -q -i "ready" /proc/scsi/qla2xxx/* 2>/dev/null
then
total_hbas=`ls -1 /proc/scsi/qla2xxx/* | wc -l`
num_online_hba=`grep -i "ready" /proc/scsi/qla2xxx/*| wc -l`
echo "Linux discovered $num_online_hba is online out of $total_hbas cards."
for h in `ls -1 /proc/scsi/qla2xxx/*`
do
wwn=`cat $h|grep "scsi-qla.-adapter-port*" | awk -F= '{print $2}' | sed -e 's|;||g'`
grep -i -q "Host adapter.*ready" $h && echo "HBA : $wwn is Online" || echo "HBA : $wwn is Offline"
done
fi
}
Thursday, October 3, 2013
LVM and hosttag
hi all,
LVM is working well with host tag especially when working for a active/passive cluster nodes. There are just some simple lines needed at /etc/lvm/lvm.conf
1. volume_list = [ "vg00", "vg01", "vg02", "vg03", "vg04", "vg05" ]
2. tags { hosttags = 1 }
At the same time, you have to create another conf file with this command
echo "activation { volume_list=["@`hostname -f`"] }" > /etc/lvm/lvm_`hostname -f`.conf
So, the result with the something like this.
[root@node01c lvm]# cat /etc/lvm/lvm_node01c.hiu.com.conf
activation { volume_list=["@node01c.hiu.com"] }
Another method to determine your tagging is working fine by using the command lvs.
[root@node01c lvm]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
crash vg00 -wi-ao-- 7.81g
home vg00 -wi-ao-- 4.00g
opt vg00 -wi-ao-- 4.00g
tmp vg00 -wi-ao-- 4.00g
usr vg00 -wi-ao-- 4.00g
var vg00 -wi-ao-- 4.00g
lvol01 vg01 -wi-ao-- 3.98g
lvol01 vg02 -wi-ao-- 71.98g
lvol01 vg03 -wi-ao-- 1.98g
lvol01 vg04 -wi-ao-- 61.98g
lvol01 vg05 -wi-ao-- 4.98g
[root@node02c lvm]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
crash vg00 -wi-ao-- 7.81g
home vg00 -wi-ao-- 4.00g
opt vg00 -wi-ao-- 4.00g
tmp vg00 -wi-ao-- 4.00g
usr vg00 -wi-ao-- 4.00g
var vg00 -wi-ao-- 4.00g
lvol01 vg01 -wi----- 3.98g
lvol01 vg02 -wi----- 71.98g
lvol01 vg03 -wi----- 1.98g
lvol01 vg04 -wi----- 61.98g
lvol01 vg05 -wi----- 4.98g
LVM is working well with host tag especially when working for a active/passive cluster nodes. There are just some simple lines needed at /etc/lvm/lvm.conf
1. volume_list = [ "vg00", "vg01", "vg02", "vg03", "vg04", "vg05" ]
2. tags { hosttags = 1 }
At the same time, you have to create another conf file with this command
echo "activation { volume_list=["@`hostname -f`"] }" > /etc/lvm/lvm_`hostname -f`.conf
So, the result with the something like this.
[root@node01c lvm]# cat /etc/lvm/lvm_node01c.hiu.com.conf
activation { volume_list=["@node01c.hiu.com"] }
Once you are done, pretty much you are done.
When you are importing the vg01, you will need to add a tag onto it: vgchange --addtag vg01 upon the activation. Otherwise, you have to deport it so another node within the cluster can import it. To deport it, you have to do vgchange --deltag vg01.
if you are working well, you will notice that the tagging is working against the lvdisplay too. For example:
[root@node01c lvm]# lvdisplay @node01c.hiu.com
--- Logical volume ---
LV Path /dev/vg02/lvol01
LV Name lvol01
VG Name vg02
LV UUID CXLHnj-FWUY-Puej-r2SN-S7d5-Bkse-Ufx9yH
LV Write Access read/write
LV Creation host, time node01c.hiu.com, 2013-10-03 15:34:30 +0800
LV Status available
# open 1
LV Size 71.98 GiB
Current LE 18428
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:19
Whereas, in the passive node, you wont find any output is printed.
[root@node02c lvm]# lvdisplay @node02c.hiu.com
[root@node02c lvm]#
Another method to determine your tagging is working fine by using the command lvs.
[root@node01c lvm]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
crash vg00 -wi-ao-- 7.81g
home vg00 -wi-ao-- 4.00g
opt vg00 -wi-ao-- 4.00g
tmp vg00 -wi-ao-- 4.00g
usr vg00 -wi-ao-- 4.00g
var vg00 -wi-ao-- 4.00g
lvol01 vg01 -wi-ao-- 3.98g
lvol01 vg02 -wi-ao-- 71.98g
lvol01 vg03 -wi-ao-- 1.98g
lvol01 vg04 -wi-ao-- 61.98g
lvol01 vg05 -wi-ao-- 4.98g
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
crash vg00 -wi-ao-- 7.81g
home vg00 -wi-ao-- 4.00g
opt vg00 -wi-ao-- 4.00g
tmp vg00 -wi-ao-- 4.00g
usr vg00 -wi-ao-- 4.00g
var vg00 -wi-ao-- 4.00g
lvol01 vg01 -wi----- 3.98g
lvol01 vg02 -wi----- 71.98g
lvol01 vg03 -wi----- 1.98g
lvol01 vg04 -wi----- 61.98g
lvol01 vg05 -wi----- 4.98g
with this output, you can clearly see that there is a string like "wi-ao" appended onto the activated volume at the active node.
Sunday, September 29, 2013
Configuring bonding: RTNETLINK answers: File exists
hi all,
Today, I am trying to configure a active/passive bonding for linux, but keep hitting the same error when I restarted the network services.
[root@node01 network-scripts]# /etc/init.d/network restart
Shutting down interface bond0: [ OK ]
Shutting down interface bond1: [ OK ]
Shutting down interface eth12: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface bond0: [ OK ]
Bringing up interface bond1: [ OK ]
Bringing up interface eth2: RTNETLINK answers: File exists
[ OK ]
Bringing up interface eth12: [ OK ]
After all, you can verify your configuration at
[root@node01 network-scripts]# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth2
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 1000
Down Delay (ms): 0
Slave Interface: eth2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 3c:d9:2b:f4:a1:9a
Slave queue ID: 0
Slave Interface: eth9
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 44:1e:a1:17:f8:76
Slave queue ID: 0
Today, I am trying to configure a active/passive bonding for linux, but keep hitting the same error when I restarted the network services.
[root@node01 network-scripts]# /etc/init.d/network restart
Shutting down interface bond0: [ OK ]
Shutting down interface bond1: [ OK ]
Shutting down interface eth12: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface bond0: [ OK ]
Bringing up interface bond1: [ OK ]
Bringing up interface eth2: RTNETLINK answers: File exists
[ OK ]
Bringing up interface eth12: [ OK ]
I have spent a couples of minutes to trouble but no luck. I took a rest then when back and look closely at my ifcfg-eth* configuration files and I discovered a silly mistake like this. I have stated SLAVE=no at ifcfg-eth2. that's why it keeps on complaining the problem.
[root@node01 network-scripts]# grep bond1 ifcfg-*
ifcfg-bond1:DEVICE=bond1
ifcfg-eth2:MASTER=bond1
ifcfg-eth9:MASTER=bond1
[root@node01 network-scripts]# cat ifcfg-eth2
DEVICE=eth2
BOOTPROTO=none
ONBOOT=yes
MASTER=bond1
SLAVE=no
USERCTL=no
HWADDR=3C:D9:2B:F4:A1:9A
[root@node01 network-scripts]# cat ifcfg-eth9
DEVICE=eth9
BOOTPROTO=none
ONBOOT=yes
MASTER=bond1
SLAVE=yes
USERCTL=no
HWADDR=44:1E:A1:17:F8:76
Hope that you wont be as silly as I am.
After all, you can verify your configuration at
[root@node01 network-scripts]# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth2
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 1000
Down Delay (ms): 0
Slave Interface: eth2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 3c:d9:2b:f4:a1:9a
Slave queue ID: 0
Slave Interface: eth9
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 44:1e:a1:17:f8:76
Slave queue ID: 0
Tuesday, September 17, 2013
Script to kill the command with timeout.
If you don't bother to wait the command to timeout. You can have a bash script as a wrapper to clean the PID within your defined timeout values. I came across the same function like this before in my senior codes, just can't recall how is the codes goes. Now, I am totally rewrite it based on my memory. Hope that it can help you when doing bash coding.
function run_with_command () {
}
function run_with_command () {
CMD=$1
TIMEOUT=$2
COUNTER=0
${CMD} &
CMD_PID=$!
while ps $CMD_PID > /dev/null && [ $COUNTER -lt $TIMEOUT ]; do
sleep 1
COUNTER=$((COUNTER+1))
done
if [ $COUNTER -eq $TIMEOUT ]
then
kill $CMD_PID 2>/dev/null
fi
wait $CMD_PID 2>/dev/null
}
Script to rescan the offline disk
I have a function to detect the offline disks, delete them then, re-scan it. Hope that it can help you from your daily Linux operation.
function fix_stale_disk ()
{
echo_header
if grep -q -i offline /sys/block/*/device/state
then
#Checking for offline disks
echo "Linux discovered offline disks."
grep -l -i offline /sys/block/*/device/state
echo "Do you want to fix the offline disks? (y/n)"
read ans
if [[ "$ans" == "y" || "$ans" == 'Y' ]]
then
for block in `grep -l -i offline /sys/block/*/device/state | awk -F/ '{print $4}'`
do
status=""
echo -n "Deleting /dev/$block ..."
echo 1 > /sys/block/$block/device/delete
if [[ "$?" -eq "0" ]]
then
status="Done"
else
status="Failed"
fi
sleep 5
echo " $status"
done
echo ""
#Rescanning the disks.
for f in `ls -1 /sys/class/fc_host/*/issue_lip 2>/dev/null`
do
echo "Rescanning $f ..."
echo 1 > $f
sleep 5
done
else
echo "You have halted the operation."
exit 1
fi
else
echo "All disks are good."
fi
}
function fix_stale_disk ()
{
echo_header
if grep -q -i offline /sys/block/*/device/state
then
#Checking for offline disks
echo "Linux discovered offline disks."
grep -l -i offline /sys/block/*/device/state
echo "Do you want to fix the offline disks? (y/n)"
read ans
if [[ "$ans" == "y" || "$ans" == 'Y' ]]
then
for block in `grep -l -i offline /sys/block/*/device/state | awk -F/ '{print $4}'`
do
status=""
echo -n "Deleting /dev/$block ..."
echo 1 > /sys/block/$block/device/delete
if [[ "$?" -eq "0" ]]
then
status="Done"
else
status="Failed"
fi
sleep 5
echo " $status"
done
echo ""
#Rescanning the disks.
for f in `ls -1 /sys/class/fc_host/*/issue_lip 2>/dev/null`
do
echo "Rescanning $f ..."
echo 1 > $f
sleep 5
done
else
echo "You have halted the operation."
exit 1
fi
else
echo "All disks are good."
fi
}
Friday, June 28, 2013
Linux, Who eaten up my memory?
Linux, Who eaten up my memory?
if you want to know which PID that chewing up your memory and not letting go? Here is the small bash script.#!/bin/bash
echo
for pid in `grep -i VmSize /proc/*/status | sort -k +2n | tail -n10 | awk -F"/" '{print $3}'`
do
echo "************************"
echo "PID: $pid"
echo "Allocated memory: `grep VmSize /proc/$pid/status | awk -F":" '{print $2" "$3}'`"
echo `ps -aef | grep $pid | grep -v grep`
done
echo
Thursday, June 27, 2013
Python in Action: Search for big file in Linux
Python in Action: Search for big file in Linux
Here is the codes. Hope that you will love it.
import os
def search():
filesize = 0
filename = ''
for root, dirs, files in os.walk('/'):
for f in files:
f = os.path.join(root, f)
if os.path.isfile(f):
if os.path.getsize(f) > filesize:
filesize = os.path.getsize(f)
filename = os.path.getrealpath(f)
print "file: %s ==> size: %s" % (filename, filesize)
else:
break
if __name__ == '__main__':
search()
Friday, June 7, 2013
whoami?? whoami??
hi all,
I came across a weird case when I am working today. But, I am able to solve the problem in a minute. Just hope that I can share it out. The problem sounds as like below.
login as: hiuy
Last login: Fri Jun 7 09:01:01 2013 from 16.189.90.136
-bash: /etc/profile: Permission denied
-bash-3.2$
I came across a weird case when I am working today. But, I am able to solve the problem in a minute. Just hope that I can share it out. The problem sounds as like below.
login as: hiuy
Last login: Fri Jun 7 09:01:01 2013 from 16.189.90.136
-bash: /etc/profile: Permission denied
-bash-3.2$
-bash-3.2$ id
uid=121738973 gid=6347 groups=10,6347,12132,12178
-bash-3.2$ whoami
whoami: cannot find name for user ID 121738973
[root@test ~]# ls -al /etc/passwd /etc/shadow /etc/group
-rw-r--r-- 1 root root 29575 Jun 7 08:02 /etc/passwd
-rw-r--r-- 1 root root 4368 Jun 7 08:55 /etc/group
-r-------- 1 root root 9012 Jun 7 08:02 /etc/shadow
The permission for the three important files are perfectly looks okay. So, What is the fault??
This is the hint....
-bash-3.2$ ls -al /etc/passwd
ls: /etc/passwd: Permission denied
The Answer is here...
[root@test /]# ls -al | grep etc
drwx------ 89 root root 12288 Jun 7 08:55 etc
etc is having 700 only. No permission for mortal user to read and accessing /etc/passwd! So, chmod it to 755 /etc, and that's the end of the story!
This is cunning, but I like it....
Sunday, May 12, 2013
Openldap bug on centos6,4
Openldap bug on centos6,4
When you are setting up the new openldap server, specifically with the following combination.[root@centos6-01 openldap]# cat /etc/centos-release
CentOS release 6.4 (Final)
[root@centos6-01 openldap]# uname -r
2.6.32-358.6.1.el6.x86_64
[root@centos6-01 openldap]# rpm -qa | grep openldap-servers
openldap-servers-2.4.23-32.el6_4.1.x86_64
Most of the problem that you will hit when you are trying to add a first ldap entry from a ldif file was "ldap_bind invalid credentials (49)". Luckily, when you are doing a search from google, you should be able to find this link to help you to solve the problem. http://www.ezylinux.com/en/red-hat-6-how-to-fixes-ldapadd-ldap_bind-invalid-credentials-49/. However, right after you have applied the commands, I just found "ANOTHER" bug on the daemon script as depicted as below. Even though the daemon script yielded an error message, but the slapd process will still spawned out, which I think it is a bit ugly.
[root@centos6-01 openldap]# /etc/init.d/slapd start
ln: accessing `/var/run/openldap/slapd.pid': No such file or directory
[root@centos6-01 openldap]# pidof slapd
1857
[root@centos6-01 openldap]# ps -eaf | grep slapd
ldap 1857 1 0 15:07 ? 00:00:00 /usr/sbin/slapd -h ldap:/// ldapi:/// -u ldap
I keep on finding for bug list reported from the redhat bugzilla, but I have no luck. So, I decided to hack the daemon script, /etc/init.d/slapd. In this script, you will find some lines sound as below.
# Start daemons.
echo -n $"Starting $prog: "
daemon --pidfile=$pidfile --check=$prog $ulimit ${slapd} -h "\"$harg\"" -u ${user} $OPTIONS $SLAPD_OPTIONS
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
touch $lockfile
ln $slapd_pidfile $pidfile
fi
So, this is my hacked version. Please pay more attention on the highlighted lines.
# Start daemons.
echo -n $"Starting $prog: "
daemon --pidfile=$pidfile --check=$prog $ulimit ${slapd} -h "\"$harg\"" -u ${user} $OPTIONS $SLAPD_OPTIONS
pidof ${slapd} > $pidfile
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
touch $lockfile
#ln $slapd_pidfile $pidfile
ln $pidfile $slapd_pidfile
fi
With this, I can start/stop my daemon with no problem.
[root@centos6-01 cn=config]# /etc/init.d/slapd start
Starting slapd: [ OK ]
[root@centos6-01 cn=config]# /etc/init.d/slapd stop
Stopping slapd: [ OK ]
I am not sure if Centos community aware of this bug. But, I am just sharing it out, in hoping that the bug will be fixed in future.
Thursday, May 9, 2013
Network devices comes with UUID? What is nmcli? PART 1
Network devices comes with UUID? What is nmcli? PART 1
The whole notion to explore on the network configuration was because of the curiosity when I bounced the network services and found out "something" new.[root@localhost network-scripts]# /etc/init.d/network restart
Shutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/10
state: activated
Connection activated
[ OK ]
So, what is the highlighted lines telling me? I have never seen this before in my past 10 years using Linux. So, when I dig more on it, I found out it was actually invoked by the /sbin/ifup command at the /etc/init.d/network script, something like ifup eth0 boot. If you drill down the script in the debug mode, then you will realize ifup is another wrapper script on top of nmcli command, where it called out something like this
nmcli con up UUID 2b58ae6b-8ad0-4fcc-ad99-582fa16d2fd9
Well, this is pretty new to me. Network configuration that ties to a UUID? That's awesome. Is nmcli (network manager cli) going to replace ifconfig command? Personally, I have a lot of doubts. Let's find out more..
This is how a ifcfg-eth0 looks like in Centos6.4
[root@localhost network-scripts]# cat ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="00:0C:29:10:6A:D3"
IPV6INIT="yes"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="2b58ae6b-8ad0-4fcc-ad99-582fa16d2fd9"
Now, nmcli tagging each of the NIC with a UUID. With that in place, nmcli make use of this and prints out something like this for you as a more user-friendly format. From the man file, it tells us that there are three main objects that governed by nmcli which is nm, con, dev.
nm: Network Manager. Use this object to inquire and change state of NetworkManager.
con: Connection. Get information about NetworkManager's connections.
dev: Device. Get information about devices.
[root@localhost network-scripts]# nmcli nm status
RUNNING STATE WIFI-HARDWARE WIFI WWAN-HARDWARE WWAN
running connected enabled enabled enabled enabled
[root@localhost network-scripts]# nmcli con status
NAME UUID DEVICES SCOPE DEFAULT VPN
System eth0 2b58ae6b-8ad0-4fcc-ad99-582fa16d2fd9 eth0 system yes no
[root@localhost network-scripts]# nmcli dev
DEVICE TYPE STATE
eth0 802-3-ethernet connected
[root@localhost network-scripts]# nmcli dev list
GENERAL.DEVICE: eth0
GENERAL.TYPE: 802-3-ethernet
GENERAL.DRIVER: e1000
GENERAL.HWADDR: 00:0C:29:10:6A:D3
GENERAL.STATE: connected
CAPABILITIES.CARRIER-DETECT: yes
CAPABILITIES.SPEED: 1000 Mb/s
WIRED-PROPERTIES.CARRIER: on
IP4-SETTINGS.ADDRESS: 192.168.195.133
IP4-SETTINGS.PREFIX: 24 (255.255.255.0)
IP4-SETTINGS.GATEWAY: 192.168.195.2
IP4-DNS1.DNS: 192.168.195.2
In sync with this command, there is another cool command, called, nm-tool.
[root@localhost network-scripts]# nm-tool
NetworkManager Tool
State: connected
- Device: eth0 [System eth0] --------------------------------------------------
Type: Wired
Driver: e1000
State: connected
Default: yes
HW Address: 00:0C:29:10:6A:D3
Capabilities:
Carrier Detect: yes
Speed: 1000 Mb/s
Wired Properties
Carrier: on
IPv4 Settings:
Address: 192.168.195.133
Prefix: 24 (255.255.255.0)
Gateway: 192.168.195.2
DNS: 192.168.195.2
From here, we can see there are a lot of useful information, e.g kernel module, e1000 is used, speed, carrier state, HW address.
Conclusion: I don't really see the need of nmcli, why it is being used? Isn't that another command to the native the command like ip? But, it is worth to reread the ifup script, and do a comparison between the old ifup and the new ifup script.
Mount CDROM in CENTOS? Hassle?
Mount CDROM in CENTOS? Hassle?
What a hassle finding the CD ROM device in Centos. The new release of Centos putting CD ROM device at /dev/sr0. Let look at the below, then you will know what is going on.
[root@localhost proc]# find /dev -name cdrom
/dev/cdrom
/dev/.udev/links/cdrom
[root@localhost proc]# ls -al /dev/cdrom
lrwxrwxrwx. 1 root root 3 May 9 13:46 /dev/cdrom -> sr0
[root@localhost proc]# ls -al /dev/| grep sr0
lrwxrwxrwx. 1 root root 3 May 9 13:46 cdrom -> sr0
lrwxrwxrwx. 1 root root 3 May 9 13:46 dvd -> sr0
lrwxrwxrwx. 1 root root 3 May 9 13:46 scd0 -> sr0
brw-rw----. 1 root cdrom 11, 0 May 9 13:46 sr0
[root@localhost proc]# mount -r -t iso9660 /dev/sr0 /mnt
[root@localhost proc]# cd /mnt/
[root@localhost mnt]# ls -al
total 685
dr-xr-xr-x. 7 root root 4096 Mar 5 10:33 .
dr-xr-xr-x. 22 root root 4096 May 9 13:44 ..
-r--r--r--. 2 root root 14 Mar 5 10:28 CentOS_BuildTag
-r--r--r--. 1 root root 31 Mar 5 10:31 .discinfo
dr-xr-xr-x. 3 root root 2048 Mar 4 17:05 EFI
-r--r--r--. 2 root root 212 Mar 2 09:46 EULA
-r--r--r--. 2 root root 18009 Mar 2 09:46 GPL
dr-xr-xr-x. 3 root root 2048 Mar 4 17:05 images
dr-xr-xr-x. 2 root root 2048 Mar 4 17:05 isolinux
dr-xr-xr-x. 2 root root 649216 Mar 5 10:31 Packages
-r--r--r--. 2 root root 1354 Mar 2 09:45 RELEASE-NOTES-en-US.html
dr-xr-xr-x. 2 root root 4096 Mar 5 10:33 repodata
-r--r--r--. 2 root root 1706 Mar 2 09:46 RPM-GPG-KEY-CentOS-6
-r--r--r--. 2 root root 1730 Mar 2 09:46 RPM-GPG-KEY-CentOS-Debug-6
-r--r--r--. 2 root root 1730 Mar 2 09:46 RPM-GPG-KEY-CentOS-Security-6
-r--r--r--. 2 root root 1734 Mar 2 09:46 RPM-GPG-KEY-CentOS-Testing-6
-r--r--r--. 1 root root 3380 Mar 5 10:33 TRANS.TBL
-r--r--r--. 1 root root 338 Mar 5 10:33 .treeinfo
Voila, I am done. Next remember, you can source for /dev/sr0. For me, this is something new.
Monday, May 6, 2013
Linux dm-multipath on local disk?
Linux dm-multipath on local disk?
Compiled by : Hiu, Yen-Onn (yenonn@gmail.com), 7th May
2013
Problem: If you are running a Linux, RHEL5 or RHEL6, some
machines have local scsi disks that been detected by dm-multipath. It is a
known fault on the configuration and strongly not recommended for local disks. Please
read this link from Redhat for future clarification. (https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html-single/DM_Multipath/#ignore_localdisk_procedure)
This is the scenario when you first login to a login
problematic Linux/dm-multipath server. You
should see the multipathing is acquiring the / and /boot mount points. As the
result, we can’t stop the multipathd because some of the disks are being used
by the system.
Even with some of the /etc/multipath.conf blacklisted local scsi
disk, we still can see the local disks are not been ignored by the dm-multipath.
[root@s11t0008c ~]# uname -r
2.6.32-220.4.2.el6.x86_64
[hiuy@s11t0008c ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/mpathap3
1008M 459M 498M
48% /
tmpfs 32G 0
32G 0% /dev/shm
/dev/mapper/mpathap1 186M
59M 118M 34% /boot
/dev/mapper/vg00-home
4.0G 158M
3.6G 5% /home
/dev/mapper/vg00-opt 4.0G
1.7G 2.1G 45% /opt
/dev/mapper/vg00-tmp 4.0G
138M 3.7G 4% /tmp
/dev/mapper/vg00-usr 4.0G
1.3G 2.6G 33% /usr
/dev/mapper/vg00-var 4.0G
634M 3.2G 17% /var
/dev/mapper/vg00-crash
7.7G 923M
6.4G 13% /var/crash
tmpfs 4.0K 0
4.0K 0% /dev/vx
This is the snippet of the /etc/multipath.conf
blacklist {
#
devnode ".*"
devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
devnode "^hd[a-z]"
devnode "^dcssblk[0-9]*"
device {
vendor "DGC"
product "LUNZ"
}
device {
vendor "IBM"
product "S/390.*"
}
# don't count normal SATA devices as multipaths
device {
vendor "ATA"
}
# don't count 3ware devices as multipaths
device {
vendor "3ware"
}
device {
vendor "AMCC"
}
# nor highpoint devices
device {
vendor "HP.*"
}
wwid 3600508b1001030363945374330300f00
}
[root@s11t0008c ~]# multipath -ll
mpatha (3600508b1001030363945374330300f00) dm-0 HP,LOGICAL VOLUME
size=279G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
`- 0:0:0:1 sda 8:0 active ready running
[root@s11t0008c sysconfig]# cat
/etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Sep 28
08:12:03 2012
#
# Accessible filesystems, by reference,
are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8),
mount(8) and/or blkid(8) for more info
#
UUID=e65ac106-53a5-4f0d-bd5e-ad563883c7d8
/ ext4 defaults 1 1
UUID=4d5a5077-8582-4f3d-8708-2588644686d1
/boot ext3 defaults 1 2
/dev/mapper/vg00-home /home ext4 defaults 1 2
/dev/mapper/vg00-opt /opt ext4 defaults 1 2
/dev/mapper/vg00-tmp /tmp ext4 defaults 1 2
/dev/mapper/vg00-usr /usr ext4 defaults 1 2
/dev/mapper/vg00-var /var ext4 defaults 1 2
UUID=5caa587b-f2d4-4063-9db3-f9b2901e816d
swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults
0 0
/dev/vg00/crash /var/crash ext3
defaults 2 2
In order to trace the UUID on
the / mount point, we can query the blkid table on the devices that had been
registered. The
[root@s11t0008c ~]# blkid -U
e65ac106-53a5-4f0d-bd5e-ad563883c7d8
/dev/mapper/mpathap3
Solution to the problem
You have to make sure that you have local disks that had
been blacklisted. In this case, you can specify individual devices by their
WWID (world-wide Identification) with the wwid entry in the blacklist section
of the configuration file.
For example:
blacklist {
wwid 3600508b1001030363945374330300f00
}
To verify the devices had been blacklisted you can use the
command “multipath –v4” and you should see the output as below.
===== paths list =====
uuid hcil dev
dev_t pri dm_st chk_st vend/pr
3600508b1001030363945374330300f00
0:0:0:1 sda 8:0 1
undef ready HP,LOGI
3600508b4000756cf0000a000029d0000 1:0:0:1
sdb 8:16 10
undef ready HP,HSV2
.
.
May
06 23:01:06 | sda: (HP:LOGICAL VOLUME) vendor/product blacklisted
May 06 23:01:06 | sdb: (HP:HSV210)
vendor/product blacklisted
.
.
Then, you have to recompile the initramdisk, to make sure
that during the booting (init), the HP logical disk (local disk) is
blacklisted.
1.
Backup your initial initramdisk
[root@s11t0008c boot]# cp -p /boot/initramfs-`uname
-r`.img /boot/initramfs-`uname -r`.img.bak
2.
Generate the new initramdisk and reboot the
server.
[root@s11t0008c boot]# mkinitrd –force
/boot/initramfs-`uname -r`.img `uname -r`
[root@s11t0008c boot]# init 6
Post configuration/verification
Once you are done with the reboot, you should see this.
[root@s11t0008c
~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 1008M 459M
499M 48% /
tmpfs 32G 0
32G 0% /dev/shm
/dev/sda1 186M 168M
9.2M 95% /boot
/dev/mapper/vg00-home
4.0G 158M
3.6G 5% /home
/dev/mapper/vg00-opt 4.0G
1.7G 2.1G 45% /opt
/dev/mapper/vg00-tmp 4.0G
138M 3.7G 4% /tmp
/dev/mapper/vg00-usr 4.0G
1.3G 2.6G 33% /usr
/dev/mapper/vg00-var 4.0G
637M 3.2G 17% /var
/dev/mapper/vg00-crash
7.7G 923M
6.4G 13% /var/crash
tmpfs 4.0K 0
4.0K 0% /dev/vx
[root@s11t0008c ~]# blkid -U
e65ac106-53a5-4f0d-bd5e-ad563883c7d8
/dev/sda3
[root@s11t0008c ~]# mpathconf
multipath is enabled
find_multipaths is disabled
user_friendly_names is enabled
dm_multipath module is loaded
multipathd is chkconfiged on
[root@s11t0008c ~]# multipath -ll
[root@s11t0008c ~]#
Subscribe to:
Posts (Atom)