首先来简要的介绍下什么是udev,udev是Linux kernel 2.6系列的通用内核设备管理器,以守护进程的方式运行于Linux系统,并监听在新设备初始化或设备从系统中移除时,内核(通过netlink socket)所发出的uevent;简单点讲就是当有多块磁盘的时候,可以用udev来固定磁盘对应的设备名;之前在部署11g rac的时候都偏好使用asmlib,在最近一次的部署中asmlib出现了问题,而又没有时间去排错,因而采用udev部署,故而简单记录下udev的配置过程!

一:模拟共享盘阵,这里采用先划分lvm,再通过iscsi共享的方式来模拟

  1. [root@db1 ~]# pvcreate /dev/sdb
  2. Physical volume "/dev/sdb" successfully created
  3. [root@db1 ~]# vgcreate data /dev/sdb
  4. /dev/hdc: open failed: Read-only file system
  5. /dev/cdrom: open failed: Read-only file system
  6. Attempt to close device '/dev/cdrom' which is not open.
  7. Volume group "data" successfully created
  8. [root@db1 ~]# lvcreate -n crs1 -L 2G data
  9. Logical volume "crs1" created
  10. [root@db1 ~]# lvcreate -n crs2 -L 2G data
  11. Logical volume "crs2" created
  12. [root@db1 ~]# lvcreate -n crs3 -L 2G data
  13. Logical volume "crs3" created
  14. [root@db1 ~]# lvcreate -n data -L 10G data
  15. Logical volume "data" created
  16. [root@db1 ~]# lvcreate -n fra -L 10G data
  17. Logical volume "fra" created
  18. [root@db1 ~]# lvs
  19. LV   VG   Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  20. crs1 data -wi-a-  2.00G
  21. crs2 data -wi-a-  2.00G
  22. crs3 data -wi-a-  2.00G
  23. data data -wi-a- 10.00G
  24. fra  data -wi-a- 10.00G
  25. [root@db1 ~]# service tgtd start
  26. Starting SCSI target daemon: [  OK  ]
  27. [root@db1 ~]# cat iscsi.sh
  28. tgtadm  --lld iscsi --op new --mode target --tid 1 -T iqn.2012-07-04.com.yang.rac:crs1
  29. tgtadm  --lld iscsi --op new --mode target --tid 2 -T iqn.2012-07-04.com.yang.rac:crs2
  30. tgtadm  --lld iscsi --op new --mode target --tid 3 -T iqn.2012-07-04.com.yang.rac:crs3
  31. tgtadm  --lld iscsi --op new --mode target --tid 4 -T iqn.2012-07-04.com.yang.rac:data
  32. tgtadm  --lld iscsi --op new --mode target --tid 5 -T iqn.2012-07-04.com.yang.rac:fra
  33. tgtadm  --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/data/crs1
  34. tgtadm  --lld iscsi --op new --mode logicalunit --tid 1 --lun 2 -b /dev/data/crs2
  35. tgtadm  --lld iscsi --op new --mode logicalunit --tid 1 --lun 3 -b /dev/data/crs3
  36. tgtadm  --lld iscsi --op new --mode logicalunit --tid 1 --lun 4 -b /dev/data/data
  37. tgtadm  --lld iscsi --op new --mode logicalunit --tid 1 --lun 5 -b /dev/data/fra
  38. tgtadm  --lld iscsi --op bind --mode target --tid 1 -I ALL
  39. tgtadm  --lld iscsi --op bind --mode target --tid 2 -I ALL
  40. tgtadm  --lld iscsi --op bind --mode target --tid 3 -I ALL
  41. tgtadm  --lld iscsi --op bind --mode target --tid 4 -I ALL
  42. tgtadm  --lld iscsi --op bind --mode target --tid 5 -I ALL
  43. [root@db1 ~]# tgtadm --lld iscsi -o show -m target
  44. [root@db1 ~]# sh iscsi.sh
  45. [root@db1 ~]# tgtadm --lld iscsi -o show -m target
  46. Target 1: iqn.2012-07-04.com.yang.rac:crs1
  47. System information:
  48. Driver: iscsi
  49. State: ready
  50. I_T nexus information:
  51. LUN information:
  52. LUN: 0
  53. Type: controller
  54. SCSI ID: deadbeaf1:0
  55. SCSI SN: beaf10
  56. Size: 0 MB
  57. Online: Yes
  58. Removable media: No
  59. Backing store: No backing store
  60. LUN: 1
  61. Type: disk
  62. SCSI ID: deadbeaf1:1
  63. SCSI SN: beaf11
  64. Size: 2147 MB
  65. Online: Yes
  66. Removable media: No
  67. Backing store: /dev/data/crs1
  68. LUN: 2
  69. Type: disk
  70. SCSI ID: deadbeaf1:2
  71. SCSI SN: beaf12
  72. Size: 2147 MB
  73. Online: Yes
  74. Removable media: No
  75. Backing store: /dev/data/crs2
  76. LUN: 3
  77. Type: disk
  78. SCSI ID: deadbeaf1:3
  79. SCSI SN: beaf13
  80. Size: 2147 MB
  81. Online: Yes
  82. Removable media: No
  83. Backing store: /dev/data/crs3
  84. LUN: 4
  85. Type: disk
  86. SCSI ID: deadbeaf1:4
  87. SCSI SN: beaf14
  88. Size: 10737 MB
  89. Online: Yes
  90. Removable media: No
  91. Backing store: /dev/data/data
  92. LUN: 5
  93. Type: disk
  94. SCSI ID: deadbeaf1:5
  95. SCSI SN: beaf15
  96. Size: 10737 MB
  97. Online: Yes
  98. Removable media: No
  99. Backing store: /dev/data/fra
  100. Account information:
  101. ACL information:
  102. ALL
  103. Target 2: iqn.2012-07-04.com.yang.rac:crs2
  104. System information:
  105. Driver: iscsi
  106. State: ready
  107. I_T nexus information:
  108. LUN information:
  109. LUN: 0
  110. Type: controller
  111. SCSI ID: deadbeaf2:0
  112. SCSI SN: beaf20
  113. Size: 0 MB
  114. Online: Yes
  115. Removable media: No
  116. Backing store: No backing store
  117. Account information:
  118. ACL information:
  119. Target 3: iqn.2012-07-04.com.yang.rac:crs3
  120. System information:
  121. Driver: iscsi
  122. State: ready
  123. I_T nexus information:
  124. LUN information:
  125. LUN: 0
  126. Type: controller
  127. SCSI ID: deadbeaf3:0
  128. SCSI SN: beaf30
  129. Size: 0 MB
  130. Online: Yes
  131. Removable media: No
  132. Backing store: No backing store
  133. Account information:
  134. ACL information:
  135. Target 4: iqn.2012-07-04.com.yang.rac:data
  136. System information:
  137. Driver: iscsi
  138. State: ready
  139. I_T nexus information:
  140. LUN information:
  141. LUN: 0
  142. Type: controller
  143. SCSI ID: deadbeaf4:0
  144. SCSI SN: beaf40
  145. Size: 0 MB
  146. Online: Yes
  147. Removable media: No
  148. Backing store: No backing store
  149. Account information:
  150. ACL information:
  151. Target 5: iqn.2012-07-04.com.yang.rac:fra
  152. System information:
  153. Driver: iscsi
  154. State: ready
  155. I_T nexus information:
  156. LUN information:
  157. LUN: 0
  158. Type: controller
  159. SCSI ID: deadbeaf5:0
  160. SCSI SN: beaf50
  161. Size: 0 MB
  162. Online: Yes
  163. Removable media: No
  164. Backing store: No backing store
  165. Account information:
  166. ACL information:

二:在客户端上挂载前面模拟出的共享磁盘阵列

  1. [root@db2 ~]# iscsiadm --mode discovery --type sendtargets --portal 192.168.123.10
  2. 192.168.123.10:3260,1 iqn.2012-07-04.com.yang.rac:fra
  3. 192.168.123.10:3260,1 iqn.2012-07-04.com.yang.rac:crs1
  4. 192.168.123.10:3260,1 iqn.2012-07-04.com.yang.rac:crs3
  5. 192.168.123.10:3260,1 iqn.2012-07-04.com.yang.rac:data
  6. 192.168.123.10:3260,1 iqn.2012-07-04.com.yang.rac:crs2
  7. [root@db2 ~]# iscsiadm --mode node --targetname iqn.2012-07-04.com.yang.rac:crs1 --portal 192.168.123.10 --login
  8. [root@db2 ~]# iscsiadm --mode node --targetname iqn.2012-07-04.com.yang.rac:crs2 --portal 192.168.123.10 --login
  9. [root@db2 ~]# iscsiadm --mode node --targetname iqn.2012-07-04.com.yang.rac:crs3 --portal 192.168.123.10 --login
  10. [root@db2 ~]# iscsiadm --mode node --targetname iqn.2012-07-04.com.yang.rac:data --portal 192.168.123.10 --login
  11. [root@db2 ~]# iscsiadm --mode node --targetname iqn.2012-07-04.com.yang.rac:fra  --portal 192.168.123.10 --login
  12. [root@db2 ~]# fdisk -l
  13. Disk /dev/sda: 85.8 GB, 85899345920 bytes
  14. 255 heads, 63 sectors/track, 10443 cylinders
  15. Units = cylinders of 16065 * 512 = 8225280 bytes
  16. Device Boot      Start         End      Blocks   Id  System
  17. /dev/sda1   *           1          13      104391   83  Linux
  18. /dev/sda2              14         523     4096575   82  Linux swap / Solaris
  19. /dev/sda3             524       10443    79682400   83  Linux
  20. Disk /dev/sdb: 2147 MB, 2147483648 bytes
  21. 67 heads, 62 sectors/track, 1009 cylinders
  22. Units = cylinders of 4154 * 512 = 2126848 bytes
  23. Disk /dev/sdb doesn't contain a valid partition table
  24. Disk /dev/sdc: 2147 MB, 2147483648 bytes
  25. 67 heads, 62 sectors/track, 1009 cylinders
  26. Units = cylinders of 4154 * 512 = 2126848 bytes
  27. Disk /dev/sdc doesn't contain a valid partition table
  28. Disk /dev/sdd: 2147 MB, 2147483648 bytes
  29. 67 heads, 62 sectors/track, 1009 cylinders
  30. Units = cylinders of 4154 * 512 = 2126848 bytes
  31. Disk /dev/sdd doesn't contain a valid partition table
  32. Disk /dev/sde: 10.7 GB, 10737418240 bytes
  33. 64 heads, 32 sectors/track, 10240 cylinders
  34. Units = cylinders of 2048 * 512 = 1048576 bytes
  35. Disk /dev/sde doesn't contain a valid partition table
  36. Disk /dev/sdf: 10.7 GB, 10737418240 bytes
  37. 64 heads, 32 sectors/track, 10240 cylinders
  38. Units = cylinders of 2048 * 512 = 1048576 bytes
  39. Disk /dev/sdf doesn't contain a valid partition table

三:开始配置udev

  1. [root@db2 ~]# uname -r  //在本例中操作系统的版本位centos5.4 64bit
  2. 2.6.18-164.el5
  3. [root@db2 ~]# lsb_release -a
  4. LSB Version:    :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
  5. Distributor ID: CentOS
  6. Description:    CentOS release 5.4 (Final)
  7. Release:        5.4
  8. Codename:       Final
  9. [root@db2 ~]# rpm -qa |grep udev
  10. udev-095-14.21.el5
  11. [root@db2 ~]# ps -ef |grep udev
  12. root      4646     1  0 10:14 ?        00:00:00 /sbin/udevd -d
  13. root      6023  3039  0 10:32 pts/0    00:00:00 grep udev
  14. [root@db2 ~]# grep -v ^# /etc/udev/udev.conf  |grep -v ^$
  15. udev_log="err"
  16. [root@db2 ~]# scsi_id -g -u -s /block/sdb
  17. S_beaf11
  18. [root@db2 ~]# scsi_id -g -u -s /block/sdc
  19. S_beaf12
  20. [root@db2 ~]# scsi_id -g -u -s /block/sdd
  21. S_beaf13
  22. [root@db2 ~]# scsi_id -g -u -s /block/sde
  23. S_beaf14
  24. [root@db2 ~]# scsi_id -g -u -s /block/sdf
  25. S_beaf15
  26. [root@db2 ~]# cat /etc/udev/rules.d/99-raw.rules
  27. KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="S_beaf11", NAME="asmdisk1", OWNER="grid",
  28. GROUP="asmadmin", MODE="0660"
  29. KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="S_beaf12", NAME="asmdisk2", OWNER="grid",
  30. GROUP="asmadmin", MODE="0660"
  31. KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="S_beaf13", NAME="asmdisk3", OWNER="grid",
  32. GROUP="asmadmin", MODE="0660"
  33. KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="S_beaf14", NAME="asmdisk4", OWNER="grid",
  34. GROUP="asmadmin", MODE="0660"
  35. KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="S_beaf15", NAME="asmdisk5", OWNER="grid",
  36. GROUP="asmadmin", MODE="0660"
  37. [root@db2 ~]# ll /dev/asm*
  38. ls: /dev/asm*: No such file or directory
  39. [root@db2 ~]# /sbin/udevcontrol reload_rules
  40. [root@db2 ~]# /sbin/start_udev
  41. Starting udev: [  OK  ]
  42. [root@db2 ~]# ll /dev/asm*
  43. brw-rw---- 1 grid asmadmin 8, 16 Jul  4 12:05 /dev/asmdisk1
  44. brw-rw---- 1 grid asmadmin 8, 32 Jul  4 12:05 /dev/asmdisk2
  45. brw-rw---- 1 grid asmadmin 8, 48 Jul  4 12:05 /dev/asmdisk3
  46. brw-rw---- 1 grid asmadmin 8, 64 Jul  4 12:05 /dev/asmdisk4
  47. brw-rw---- 1 grid asmadmin 8, 80 Jul  4 12:05 /dev/asmdisk5

备注:
1:在vmware中,scsi_id -g -u -s /block/sdb默认是不会出现uuid,需要修改vmx文件,添加disk.EnableUUID参数
2:/block/sdb实际上是个不存在的路径,实际绝对路径是/sys/block/sdb,但使用scsi_id命令的时候必须用/block/sdb路径

参考:
http://diznix.com/2011/05/21/the-case-of-vmware-and-the-missing-scsi-id/
http://space.itpub.net/14184018/viewspace-701675

Centos5上部署udev相关推荐

  1. 云上部署oracle rac,在青云上部署oracle rac全过程

    在青云上部署oracle rac全过程 发布时间:2020-08-17 03:16:10 来源:ITPUB博客 阅读:116 作者:datapeng 一 准备 1.1服务器基本信息 节点 Cpu 内存 ...

  2. 在树莓派3B+上部署Intel NCS2神经网络计算棒

    2018.12.20日 英特尔更新了OpenVINO Toolkit R5版本.该版本添加了对树莓派的支持.作为NCS2的官方开发套件,OpenVINO在此之前只能在台式机ubuntu 16.04上使 ...

  3. 在 Linux 服务器上部署 oracle10gr2 数据库全过程

    在 Linux 服务器上部署 oracle10gr2 数据库全过程 最近在 Linux 系统上进行 oracle 服务器的部署,对于作者这种 Linux 菜鸟来说着实不容易,很是废了一番功夫.但最后还 ...

  4. 在Cuda上部署量化模型

    在Cuda上部署量化模型 介绍TVM自动量化.自动量化是TVM中的一种量化方式.将在ImageNet上导入一个GluonCV预先训练的模型到Relay,量化Relay模型,然后执行推理. import ...

  5. 用TVM在硬件平台上部署深度学习工作负载的端到端 IR 堆栈

    用TVM在硬件平台上部署深度学习工作负载的端到端 IR 堆栈 深度学习已变得无处不在,不可或缺.这场革命的一部分是由可扩展的深度学习系统推动的,如滕索弗洛.MXNet.咖啡和皮托奇.大多数现有系统针对 ...

  6. 在Server 2003上部署IIS+PHP+MySQL配置清单

    在Server 2003上部署IIS+PHP+MySQL I.安装Windows Server 2003 将光盘放入光驱中,设置BIOS,从CDROM引导加载安装程序,等待启动: 设置注册信息,名字和 ...

  7. Centos5上firefox的升级

    Centos5上firefox的升级 默认Centos5上firefox的版本是1.5 当我们使用yum update firefox 提示到的版本还是1.5  可是我们在使用1.5版本的firefo ...

  8. aws fargate_我如何在AWS Fargate上部署#100DaysOfCloud Twitter Bot

    aws fargate After passing my last certification, I asked myself how much time I spent studying cloud ...

  9. SAGEMAKER上部署需要引入sagemakder的API from sagemaker.pytorch import PyTorchModel

    SAGEMAKER上部署需要引入sagemakder的API from sagemaker.pytorch import PyTorch from sagemaker.pytorch import P ...

最新文章

  1. CSS清除浮动大全共8种方法
  2. 【Python3爬虫】最新的12306爬虫
  3. Android socket 编程 实现消息推送(二)
  4. Vijos P1067Warcraft III 守望者的烦恼
  5. python压缩映射过滤器
  6. python创建数据库计算机积极拒绝、无法连接_Python3 请求网页源码 目标计算机积极拒绝,无法连接...
  7. 这是今年前端最常见的面试题,你都会了吗?
  8. 单片机 | Keli 调试程序
  9. 软件质量保证管理办法
  10. 泛微oa服务器文件,泛微oa云服务器要求
  11. 华为手机 图标消失_华为手机桌面图标不见了怎么办
  12. 【Spring Security】spring security 之初探jwt
  13. 下载微信支付sdk的两个方法
  14. 【css技巧】CSS filter的神奇用法 | 褪色|融合效果等
  15. 第三批更新鸿蒙系统,emui11第三批更新名单-emui11第三批更新名单介绍 - 系统家园...
  16. 留着以后慢慢做的计算几何(题表)
  17. Smartbi自定义生成报表-制作流程
  18. 埃斯顿机器人 王杰高_王杰高 埃斯顿机器人公司总经理--金手指奖•2018年中国国际机器人年度评选——风云人物奖申报-弗戈工业在线...
  19. 解决outlook 一直卡在加载配置文件界面的解决方法
  20. Html(快捷键!+Tab)

热门文章

  1. Linux-Windows-Mac-Redis安装教程
  2. Spring Boot开发
  3. raid5加热备盘_联想服务器X3650 M2 配置RAID5与热备盘图文方法
  4. graphics | 基础绘图系统(八)——棘状图、符号图、多边形(路径)图、Cohen-Friendly关联图、条件密度图...
  5. 干货丨常用JS前端开发框架有哪些?
  6. javascript 校验 非空_前端(js+JQuery非空校验)
  7. Oracle修改globalname,oracle修改global_name和service_name
  8. python中delete怎么用_python删除np.deletePython基础教程05 - 缩进和选择
  9. session很快失效_深夜,我偷听到程序员要对session下手……
  10. css居中最佳方案,CSS 水平、垂直居中的5种最佳方案