亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2155 | 回復(fù): 0
打印 上一主題 下一主題

Add raw device in Red Hat Enterprise Linux 5 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2010-02-06 13:20 |只看該作者 |倒序?yàn)g覽

                How do I add raw device mapping in Red Hat Enterprise Linux 5?
Issue
How do I add raw device mapping in Red Hat Enterprise Linux 5?
Environment
Red Hat Enterprise Linux 5
Resolution
Previously
(Red Hat Enterprise Linux 5.0 through Red Hat Enterprise Linux 5.3),
support for raw devices in the upstream kernel was deprecated. However,
this support has been returned to the kernel. Consequently, in Red Hat
Enterprise Linux 5.4, support for raw devices has also been returned.
Additionally, the initscripts packages have been updated, adding the
previously dropped functionality of raw devices.
So in the Red Hat Enterprise Linux 5, there are two methods to configure RAW device.
Method 1. Using rawdevices service (Not available on RHEL5.0 -- RHEL5.3)
1. Edit the file /etc/sysconfig/rawdevices
               
               
                #!/bin/sh
grep -v "^ *#" /etc/sysconfig/rawdevices | grep -v "^$" | while read dev major
minor ; do
        if [ -z "$minor" ]; then
                echo "ACTION==\"add\", KERNEL==\"${major##/dev/}\",
RUN+=\"/usr/bin/raw $dev %N\""
        else
                echo "ACTION==\"add\", ENV{MAJOR}==\"$major\",
ENV{MINOR}==\"$minor\", RUN+=\"/usr/bin/raw $dev %M %m\""
        fi
done
2. Start the rawdevices service
#service rawdevices start
#chkconfig rawdevices on
Method 2. Using udev to configure RAW device
1. Creating the raw devices using udev:
Nevertheless, to create raw devices, add entries to /etc/udev/rules.d/60-raw.rules in the following formats:
For device names:
ACTION=="add", KERNEL=="", RUN+="raw /dev/raw/rawX %N"
For major / minor numbers:
ACTION=="add", ENV{MAJOR}="A", ENV{MINOR}="B", RUN+="raw /dev/raw/rawX %M %m"
Note: Replace  with the name of the device needed to bind (such as /dev/sda1). "A" and "B" are the major / minor numbers of the device needed for binding, an "X" is the raw device number that the system wants to use.
2. Creating persistent raw devices for single path LUNs:  
If using unpartitioned LUNs, to create a single raw device for the whole LUN use this rule format:
ACTION=="add", KERNEL=="sd*[!0-9]", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="3600601601bd2180072193a9242c3dc11", RUN+="/bin/raw /dev/raw/raw1 %N"
Note: Set the RESULT value to the output of scsi_id
-g -u -s /block/sdX (where sdX is the current path to the LUN). This
will create the raw device /dev/raw/raw1 that will be persistently
bound to the LUN with WWID 3600601601bd2180072193a9242c3dc11.
If using partitioned LUNs, where raw devices are created for each of the partitions on the LUN, use this rule format:
ACTION=="add", KERNEL=="sd*[0-9]", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="3600601601bd2180072193a9242c3dc11", RUN+="/bin/raw /dev/raw/raw%n %N"
Again, set RESULT to the output of scsi_id -g -u
-s /block/sdX. This will create the raw device(s) /dev/raw/raw1,
/dev/raw/raw2, etc. for each partition on the LUN and they will be
persistently bound to the LUN with WWID
3600601601bd2180072193a9242c3dc11.  
  
3. Setting ownership and permissions on the raw devices:  
To
set specific ownership and/or permissions for the raw devices, add
entries to /etc/udev/rules.d/60-raw.rules in the following format:
ACTION=="add", KERNEL=="raw*", OWNER=="root", GROUP=="disk", MODE=="0660"
4. Testing and implementing the udev rules:  
  
Before
implementing them, use the udevtest command to verify the udev rules
work as expected. To verify that the raw device is created for a
specific disk or partition, eg /dev/sdb1:  
[root@rhel5 rules.d]# udevtest /block/sdb/sdb1 | grep raw
main: run: '/bin/raw /dev/raw/raw1 /dev/.tmp-8-17'
To check ownership/permission settings for a particular raw device, eg /dev/raw/raw1:
[root@rhel5 rules.d]# udevtest /class/raw/raw1 | grep mode
udev_node_add: creating device node '/dev/raw/raw1', major = '162', minor = '1', mode = '0600', uid = '0', gid = '0'
Finally, to actually create the raw device(s), use the start_udev command:
[root@rhel5 rules.d]# start_udev
Starting udev:                                                                                          [  OK  ]
Check that the raw device(s) have been created:
[root@rhel5 rules.d]# raw -qa
/dev/raw/raw1:  bound to major 8, minor 17
[root@rhel5 rules.d]# ls -l /dev/raw
total 0
crw-rw---- 1 root   disk 162,  1 Jan 29 02:47 raw1
5. Creating persistent raw devices for multipathed LUNs or LVM device:  
Unfortunately
it is not possible to write udev rules for creating raw devices on
multipath devices (/dev/dm-*) without manipulating existing udev rules.
Modifying existing rules for this purpose could cause unforeseen
problems and is not supported by Red Hat Global Support Services. If
absolutely necessary, an alternate method for creating raw devices on
top of multipath devices could be to create the raw devices in
/etc/rc.d/rc.local, so long as the raw device is not required before
rc.local is executed. For example:
/bin/raw /dev/raw/raw1 /dev/mpath/mpath1p1
/bin/raw /dev/raw/raw2 /dev/mpath/mpath1p2
If absolutely want to create raw devices for multipathed LUNs or LVM
device using udev, can add the following udev rules in the file /etc/udev/rules.d/60-raw.rules
# Device mapper raw rules
KERNEL!="dm-[0-9]*", GOTO="skip_dm"
ACTION!="change", GOTO="skip_dm"
PROGRAM!="/sbin/dmsetup ls --exec /bin/basename -j %M -m %m", GOTO="skip_dm"
RESULT=="mpath2", RUN+="/bin/raw /dev/raw/raw2 /dev/mapper/mpath2"
RESULT=="mpath1", RUN+="/bin/raw /dev/raw/raw1 /dev/mapper/mpath1"
LABEL="skip_dm"
Note: The first three rules makes sure we are only
using dm devices with change actions, when dmsetup returns success. If
not, we skip down to the "skip_dm" label.  After that, the rules look
at the result of running dmsetup, and do fire off the appropriate
command.
http://magazine.redhat.com/2008/09/17/tips-and-tricks-how-do-i-add-raw-device-mapping-in-red-hat-enterprise-linux-5/
               
               

本文來自ChinaUnix博客,如果查看原文請點(diǎn):http://blog.chinaunix.net/u3/100692/showart_2178998.html
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP