2009年6月3日星期三

raw device 實驗

[root@oracle03 rules.d]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1011, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1011, default 1011):
Using default value 1011

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@oracle03 rules.d]#


ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"

[root@oracle03 rules.d]# udevtest /block/sdb/sdb1
main: looking at device '/block/sdb/sdb1' from subsystem 'block'
run_program: '/bin/bash -c '/sbin/lsmod | /bin/grep ^dm_multipath''
run_program: '/bin/bash' (stdout) 'dm_multipath 52945 0 '
run_program: '/bin/bash' returned with status 0
udev_rules_get_name: add symlink 'disk/by-id/scsi-3600508b40006c47b00005000019d0000-part1'
udev_rules_get_name: add symlink 'disk/by-path/pci-0000:0a:00.0-scsi-0:0:0:1-part1'
run_program: '/lib/udev/vol_id --export /dev/.tmp-8-17'
run_program: '/lib/udev/vol_id' returned with status 4
udev_rules_get_name: no node name set, will use kernel name 'sdb1'
udev_device_event: device '/block/sdb/sdb1' already in database, validate currently present symlinks
udev_node_add: creating device node '/dev/sdb1', major = '8', minor = '17', mode = '0640', uid = '0', gid = '6'
udev_node_add: creating symlink '/dev/disk/by-id/scsi-3600508b40006c47b00005000019d0000-part1' to '../../sdb1'
udev_node_add: creating symlink '/dev/disk/by-path/pci-0000:0a:00.0-scsi-0:0:0:1-part1' to '../../sdb1'
main: run: '/sbin/multipath -v0 8:17'
main: run: 'socket:/org/kernel/udev/monitor'
main: run: '/lib/udev/udev_run_devd'
main: run: '/bin/raw /dev/raw/raw1 /dev/.tmp-8-17'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: '/sbin/pam_console_apply /dev/sdb1 /dev/disk/by-id/scsi-3600508b40006c47b00005000019d0000-part1 /dev/disk/by-path/pci-0000:0a:00.0-scsi-0:0:0:1-part1'


[root@oracle03 rules.d]# udevtest /block/sdb/sdb1 | grep raw
main: run: '/bin/raw /dev/raw/raw1 /dev/.tmp-8-17'



[root@oracle03 init.d]# start_udev
Starting udev: [ OK ]
[root@oracle03 init.d]#

[root@oracle03 init.d]# raw -qa
/dev/raw/raw1: bound to major 8, minor 17


[root@oracle03 init.d]# ls -l /dev/raw
total 0
crw------- 1 root root 162, 1 Jun 3 17:11 raw1
[root@oracle03 init.d]#

没有评论:

发表评论