方法一、和rhel4相同,但是需要手动添加。
1.添加启动脚本
- vi /etc/init.d/rawdevices
- #!/bin/bash
-
#
-
# rawdevices This shell script assignes rawdevices to block devices
-
#
-
# chkconfig: 345 56 44
-
# description: This scripts assignes raw devices to block devices \
-
# (such as hard drive partitions). This is for the use \
-
# of applications such as Oracle. You can set up the \
-
# raw device to block device mapping by editing \
-
# the file /etc/sysconfig/rawdevices.
-
#
-
# config: /etc/sysconfig/rawdevices
-
-
[ -f /bin/raw ] || exit 0
-
[ -f /etc/sysconfig/rawdevices ] || exit 0
-
# Exit if the file just has the default comments.
-
LC_ALL=C /bin/egrep -q -v "^ *#" /etc/sysconfig/rawdevices 2>/dev/null || exit 0
-
-
. /etc/init.d/functions
-
-
function assign_raw()
-
{
-
LC_ALL=C egrep -v '^ *#' /etc/sysconfig/rawdevices |
-
while read RAW BLOCK; do
-
if [ -n "$RAW" -a -n "$BLOCK" ]; then
-
rawdirname=${RAW%/*}
-
if [ "$rawdirname" = "/dev" -a -d /dev/raw ]; then
-
echo $" Please correct your /etc/sysconfig/rawdevices:"
-
echo $" rawdevices are now located in the directory /dev/raw/ "
-
echo $" If the command 'raw' still refers to /dev/raw as a file."
-
echo $" you'll have to upgrade your util-linux package"
-
exit 0
-
fi
-
if [ "$rawdirname" = "/dev/raw" -a -f /dev/raw ]; then
-
echo $" Please correct your /etc/sysconfig/rawdevices:"
-
echo $" rawdevices are now located in the directory /dev/raw/ "
-
echo $" If the command 'raw' still refers to /dev/raw as a file."
-
echo $" you'll have to upgrade your util-linux package"
-
exit 0
-
fi
-
-
echo " $RAW --> $BLOCK";
-
raw $RAW $BLOCK
-
fi
-
done
-
}
-
-
# See how we were called.
-
case "$1" in
-
start)
-
# Assign devices
-
echo $"Assigning devices: "
-
assign_raw
-
echo $"done"
-
;;
-
stop)
-
# No action to be taken here
-
;;
-
-
status)
-
ID=`id -u`
-
if [ $ID -eq 0 ]; then
-
raw -qa
-
else
-
echo $"You need to be root to use this command ! "
-
fi
-
;;
-
-
restart|reload)
-
$0 start
-
;;
-
-
*)
-
echo $"Usage: $0 {start|stop|status|restart}"
-
exit 1
-
esac
-
-
exit 0
以上部分使用multipath也可以代替。
2.指定
- [root@rac1 ~]# cat /etc/sysconfig/rawdevices
-
/dev/raw/raw1 /dev/iscsi/rac_storage_1/part1
-
/dev/raw/raw2 /dev/iscsi/rac_storage_2/part1
3.添加到开机启动
- [root@rac1 ~]#chkconfig --add rawdevices
4.重新启动 OK
方法二、rhel5推荐的正规方法
1.添加规则
- [root@rac1 ~]# cat /etc/udev/rules.d/60-raw.rules
- ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
2.重启机器或 start_udev ,OK!
阅读(1481) | 评论(0) | 转发(0) |