rhel5 创建裸设备raw

本文发布时间: 2019-Mar-21
1. 创建分区[[email protected] ~]# fdisk /dev/sdaCommand (m for help): pDisk /dev/sda: 42.9 GB, 42949672960 bytes255 heads, 63 sectors/track, 5221 cylindersUnits = 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 LinuxCommand (m for help): nCommand action e extended p primary partition (1-4)pFirst cylinder (4961-5221, default 4961):Last cylinder or +size or +sizeM or +sizeK (4961-5221, default 5221): +20mCommand (m for help): pDisk /dev/sda: 42.9 GB, 42949672960 bytes255 heads, 63 sectors/track, 5221 cylindersUnits = 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 LinuxCommand (m for help): wThe 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.partprobeWarning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.Segmentation fault2. 创建裸设备[[email protected] ~]# raw /dev/raw/raw1 /dev/sda4/dev/raw/raw1: bound to major 8, minor 43. 使用udev自动创建裸设备[[email protected] ~]# 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[[email protected] ~]# ll /dev/rawtotal 0crw------- 1 root root 162, 1 Jun 6 11:09 raw1


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2020-Jul-13 01:11am
栏目列表