关于裸设备的映射

 

可以编辑 /etc/sysconfig/rawdevices ,使用 service rawdevices restart 命令完成裸设备的配置

1. 编辑后的 /etc/sysconfig/rawdevices 文件内容

# cat /etc/sysconfig/rawdevices

/dev/raw/raw1 /dev/sdb1

/dev/raw/raw2 /dev/sdc1

/dev/raw/raw3 /dev/sdd1

/dev/raw/raw4 /dev/sde1

2. 启动裸设备服务 # service rawdevices restart

Assigning devices:            /dev/raw/raw1  –>   /dev/sdb1 /dev/raw/raw1:  bound to major 8, minor 17           

                                      /dev/raw/raw2  –>   /dev/sdc1 /dev/raw/raw2:  bound to major 8, minor 33           

              /dev/raw/raw3  –>   /dev/sdd1 /dev/raw/raw3:  bound to major 8, minor 49           

              /dev/raw/raw4  –>   /dev/sde1 /dev/raw/raw4:  bound to major 8, minor 65 done

3. 最后的确认 # ls -l /dev/raw

crw-rw—-  1 root disk 162, 1 Jul  2 17:26 raw1

crw-rw—-  1 root disk 162, 2 Jul  2 17:26 raw2

crw-rw—-  1 root disk 162, 3 Jul  2 17:26 raw3

crw-rw—-  1 root disk 162, 4 Jul  2 17:26 raw4

使用编辑 /etc/udev/rules.d/60-raw.rules 文件,并使用 start_udev 命令完成裸设备对应关系的设定

1. 编辑后的 /etc/udev/rules.d/60-raw.rules文件内容

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

ACTION=="add",ENV{MAJOR}=="8",ENV{MINOR}=="17",RUN+="/bin/raw /dev/raw/raw1 %m"

ACTION=="add",KERNEL=="sdb2",RUN+="/bin/raw /dev/raw/raw2 %N"

ACTION=="add",ENV{MAJOR}=="8",ENV{MINOR}=="18",RUN+="/bin/raw /dev/raw/raw2 %m"

ACTION=="add",KERNEL=="sdb3",RUN+="/bin/raw /dev/raw/raw3 %N"

ACTION=="add",ENV{MAJOR}=="8",ENV{MINOR}=="19",RUN+="/bin/raw /dev/raw/raw3 %m"

ACTION=="add",KERNEL=="sdb4",RUN+="/bin/raw /dev/raw/raw4 %N"

ACTION=="add",ENV{MAJOR}=="8",ENV{MINOR}=="20",RUN+="/bin/raw /dev/raw/raw4 %m"

2.使用 start_udev 命令完成裸设备对应关系的设定

# start_udev
Starting udev: udevd[4578]: GOTO 'pulseaudio_check_usb' has no matching label in: '/lib/udev/rules.d/90-pulseaudio.rules'
[  OK  ]

 

如果执行start_udev后没有在raw下没有生成相应的文件,重启数据库即可使之生效

 

3. 最后的确认 # ls -l /dev/raw

ls -l /dev/raw
total 0
crw-rw----. 1 root disk 162, 1 Dec  8 09:33 raw1
crw-rw----. 1 root disk 162, 2 Dec  8 09:33 raw2
crw-rw----. 1 root disk 162, 3 Dec  8 09:33 raw3
crw-rw----. 1 root disk 162, 4 Dec  8 09:33 raw4
crw-rw----. 1 root disk 162, 5 Dec  8 09:33 raw5
crw-rw----. 1 root disk 162, 6 Dec  8 09:33 raw6
crw-rw----. 1 root disk 162, 7 Dec  8 09:33 raw7
crw-rw----. 1 root disk 162, 8 Dec  8 09:33 raw8

 

你可能感兴趣的:(关于裸设备的映射)