今天接到用户的保障,据说是iscsi无法自动挂载,而且重启iscsi服务之后,识别的的四个iscsi设备,第一个sdb不变,第二、三、四个iscsi设备会变化,如下用来说明
默认情况下:
[root@localhost sbin]# ./fdisk -l
Disk /dev/sda: 146.6 GB, 146695782400 bytes
255 heads, 63 sectors/track, 17834 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 10212 81923467+ 83 Linux
/dev/sda3 10213 11232 8193150 82 Linux swap
/dev/sda4 11233 17834 53030565 5 Extended
/dev/sda5 11233 12507 10241406 83 Linux
/dev/sda6 12508 17834 42789096 83 Linux
Disk /dev/sdb: 104.8 GB, 104857600000 bytes
255 heads, 63 sectors/track, 12748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 12748 102398278+ 83 Linux
Disk /dev/sdc: 104.8 GB, 104857600000 bytes
255 heads, 63 sectors/track, 12748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 12748 102398278+ 83 Linux
Disk /dev/sdd: 104.8 GB, 104857600000 bytes
255 heads, 63 sectors/track, 12748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 12748 102398278+ 83 Linux
Disk /dev/sde: 209.7 GB, 209715200000 bytes
255 heads, 63 sectors/track, 25496 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sde1 1 25496 204796588+ 83 Linux
|
重启服务后:
[root@
localhost sbin]# ./fdisk -l
Disk /dev/sda: 146.6 GB, 146695782400 bytes
255 heads, 63 sectors/track, 17834 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 10212 81923467+ 83 Linux
/dev/sda3 10213 11232 8193150 82 Linux swap
/dev/sda4 11233 17834 53030565 5 Extended
/dev/sda5 11233 12507 10241406 83 Linux
/dev/sda6 12508 17834 42789096 83 Linux
Disk /dev/sdb: 104.8 GB, 104857600000 bytes
255 heads, 63 sectors/track, 12748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 12748 102398278+ 83 Linux
Disk /dev/sdf: 104.8 GB, 104857600000 bytes
255 heads, 63 sectors/track, 12748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdf1 1 12748 102398278+ 83 Linux
Disk /dev/sdg: 104.8 GB, 104857600000 bytes
255 heads, 63 sectors/track, 12748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdg1 1 12748 102398278+ 83 Linux
Disk /dev/sdh: 209.7 GB, 209715200000 bytes
255 heads, 63 sectors/track, 25496 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdh1 1 25496 204796588+ 83 Linux
|
从上面的内容显示,每重启一次iscsi服务,设备名会往后推。暂时想可能跟配置文件有关。
另一个问题是iscsi服务无法自动挂载,打电话过去详细咨询了以下现象:以前是DC5.0单机跑,是可以自动挂载的,现在换成双机了,系统升级为DC5.0SP2之后,首先发现是不能自动挂载了,虽然修改了/etc/fstab.iscsi,但是就是不自动挂载。他还说了一句话“而且iscsi的mount和umount两个脚本也拷了”
幸好我有DC5.0和SP2的环境,我隐隐约约感觉到“自动挂载”的问题原因在两个系统版本所在的iscsi包不同造成的。但是重启iscsi服务,设备名变还想不出什么来。幸好我提前咨询了一下,先让用户重启以下iscsi服务,然后把dmesg发过来,另外把所有的iscsi配置文件都发给我。
开始分析DC5.0和SP2里面的iscsi包的问题,除了版本不同之外,还发现包内容也不同:
DC5.0自带的iscsi包内容:
[root@lvs191 /]# rpm -ql iscsi /etc/fstab.iscsi /etc/initiatorname.iscsi /etc/iscsi.conf /etc/rc.d/init.d/iscsi /sbin/iscsi-device /sbin/iscsi-iname /sbin/iscsi-ls /sbin/iscsi-mountall /sbin/iscsi-umountall /sbin/iscsid /usr/share/doc/iscsi-4.0.1.11 /usr/share/doc/iscsi-4.0.1.11/COPYING /usr/share/doc/iscsi-4.0.1.11/README /usr/share/man/man1/iscsi-ls.1.gz /usr/share/man/man5/iscsi.conf.5.gz /usr/share/man/man8/iscsid.8.gz
|
DC5.0SP2自带的iscsi包内容:
[root@lvs191 ~]# rpm -ql iscsi
/etc/fstab.iscsi
/etc/initiatorname.iscsi
/etc/iscsi.conf
/etc/rc.d/init.d/iscsi
/etc/sysconfig/iscsi
/sbin/iscsi-device
/sbin/iscsi-iname
/sbin/iscsi-ls
/sbin/iscsi-rescan
/sbin/iscsid
/usr/share/doc/iscsi-4.0.3.0
/usr/share/doc/iscsi-4.0.3.0/COPYING
/usr/share/doc/iscsi-4.0.3.0/README
/usr/share/man/man1/iscsi-ls.1.gz
/usr/share/man/man5/iscsi.conf.5.gz
/usr/share/man/man8/iscsid.8.gz
|
很明显,两个系统中的iscsi包中有两个脚本的区别,/sbin/iscsi-mountall和/sbin/iscsi-umountall,从命令名来看,就猜到是挂载和卸载设备的。那么,最可能用到这两个命令的文件就是/etc/rc.d/init.d/iscsi,我在两个系统中对比这个文件。
文件内容略。但是明显发现SP2里面这个文件内容更标准,里面多了几个函数,但是还少了一些内容。尤其少了对/etc/fstab.iscsi的判断,和/sbin/iscsi-mountall和/sbin/iscsi-umountall命令的使用。根据内容来看,我判断是SP2里面的iscsi取消了自动挂载这一步,不过我可以添加进去,实现自动挂载和卸载。修改为如下:
.........................................
# Make sure the K*iscsi scripts get called
if [ -d /var/lock/subsys ] ; then
touch /var/lock/subsys/iscsi
fi
# if we have an iSCSI fstab, process it
if [ -f /etc/fstab.iscsi ] ; then
echo -n " fsck/mount"
sleep 6
iscsi-mountall
fi
}
stop()
{ ret=0 echo -n "Stopping iscsid: "
if ! pidofproc iscsid > /dev/null 2>&1; then success "iscsid not running" echo return 0 fi
# We need a low connfail_timeout so that driver shutdown does not hang set_connfailtimeout; set_aborttimeout; set_resettimeout;
sync
# unmount all filesystems on iSCSI devices echo -n " umount" iscsi-umountall -t -k
echo -n " sync" sync sleep 3
# echo -n "Killing iscsid: " if ! killproc iscsid; then echo exit 1 fi echo
...............................................
|
应该问题不大。
另一个问题:重启iscsi服务之后,iscsi设备名变化的问题,我想应该是iscsi模块没有从内核里面彻底卸载的问题所导致,再分析以下。
自动挂载iscsi设备实现了。但是最后确认,即将安装RedFlag HA,一下午白忙活了。
阅读(1263) | 评论(0) | 转发(1) |