rhel5 创建裸设备raw
来源:互联网 发布:渡边直美自创品牌淘宝 编辑:程序博客网 时间:2024/06/05 14:08
1. 创建分区
[root@james-test ~]# fdisk /dev/sda
Command (m for help): p
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3916 31455238+ 83 Linux
/dev/sda2 3917 4438 4192965 82 Linux swap / Solaris
/dev/sda3 4439 4960 4192965 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
First cylinder (4961-5221, default 4961):
Last cylinder or +size or +sizeM or +sizeK (4961-5221, default 5221): +20m
Command (m for help): p
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3916 31455238+ 83 Linux
/dev/sda2 3917 4438 4192965 82 Linux swap / Solaris
/dev/sda3 4439 4960 4192965 83 Linux
/dev/sda4 4961 4963 24097+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
partprobe
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
Segmentation fault
2. 创建裸设备
[root@james-test ~]# raw /dev/raw/raw1 /dev/sda4
/dev/raw/raw1: bound to major 8, minor 4
3. 使用udev自动创建裸设备
[root@james-test ~]# vi /etc/udev/rules.d/60-raw.rules
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
ACTION=="add", KERNEL=="sda4", RUN+="/bin/raw /dev/raw/raw1 %N"
测试一下
reboot
[root@james-test ~]# ll /dev/raw
total 0
crw------- 1 root root 162, 1 Jun 6 11:09 raw1
[root@james-test ~]# fdisk /dev/sda
Command (m for help): p
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3916 31455238+ 83 Linux
/dev/sda2 3917 4438 4192965 82 Linux swap / Solaris
/dev/sda3 4439 4960 4192965 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
First cylinder (4961-5221, default 4961):
Last cylinder or +size or +sizeM or +sizeK (4961-5221, default 5221): +20m
Command (m for help): p
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3916 31455238+ 83 Linux
/dev/sda2 3917 4438 4192965 82 Linux swap / Solaris
/dev/sda3 4439 4960 4192965 83 Linux
/dev/sda4 4961 4963 24097+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
partprobe
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
Segmentation fault
2. 创建裸设备
[root@james-test ~]# raw /dev/raw/raw1 /dev/sda4
/dev/raw/raw1: bound to major 8, minor 4
3. 使用udev自动创建裸设备
[root@james-test ~]# vi /etc/udev/rules.d/60-raw.rules
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
ACTION=="add", KERNEL=="sda4", RUN+="/bin/raw /dev/raw/raw1 %N"
测试一下
reboot
[root@james-test ~]# ll /dev/raw
total 0
crw------- 1 root root 162, 1 Jun 6 11:09 raw1
- rhel5 创建裸设备raw
- rhel5下挂载raw设备
- linux创建raw设备
- Linux raw device 裸设备
- 转】字符设备、块设备、裸设备、RAW设备
- 字符设备、块设备、裸设备、RAW设备
- 用udev绑定裸设备(RHEL5)
- Oracle裸设备(raw device)问答
- Udev raw裸设备 asmLib区别
- 配置RAW设备
- 在DB2 UDB V8.1中使用裸(raw)设备
- Redhat 5 中裸设备(raw) 的配置
- Redhat 5 中裸设备(raw) 的配置
- SUSE Linux 10 配置裸设备(raw devices)
- Redhat 5 中裸设备(raw) 的配置
- 关于oracle12c对RAW裸设备的支持?
- SUSE Linux 10 配置裸设备(raw devices)
- SUSE Linux 10配置裸设备(raw devices)
- SQLServer数据库的锁类型总结
- Mercurial Queues (MQ) <二>
- MFC 自定义消息
- python访问PostgreSQL数据库之连接库Psycopg2
- POJ 1328 贪心 Radar Installation
- rhel5 创建裸设备raw
- 增强的内存泄漏检测工具-VLD 1.9 d.
- 配置服务器限制上传文件大小
- 自定义Adapter,通过复写getView方法,实现ListView中item背景颜色变化
- 关于链表笔试题的一些收集
- 判断输入日期是该年的第一天
- 《第十六周实验报告任务3——电子词典》
- VC++学习开始之路
- c/c++笔试题(1)