首先来简要的介绍下什么是udev,udev是Linux kernel 2.6系列的通用内核设备管理器,以守护进程的方式运行于Linux系统,并监听在新设备初始化或设备从系统中移除时,内核(通过netlink socket)所发出的uevent;简单点讲就是当有多块磁盘的时候,可以用udev来固定磁盘对应的设备名;之前在部署11g rac的时候都偏好使用asmlib,在最近一次的部署中asmlib出现了问题,而又没有时间去排错,因而采用udev部署,故而简单记录下udev的配置过程!
一:模拟共享盘阵,这里采用先划分lvm,再通过iscsi共享的方式来模拟
- [root@db1 ~]# pvcreate /dev/sdb Physical volume "/dev/sdb" successfully created
- [root@db1 ~]# vgcreate data /dev/sdb /dev/hdc: open failed: Read-only file system
- /dev/cdrom: open failed: Read-only file system Attempt to close device '/dev/cdrom' which is not open.
- Volume group "data" successfully created [root@db1 ~]# lvcreate -n crs1 -L 2G data
- Logical volume "crs1" created [root@db1 ~]# lvcreate -n crs2 -L 2G data
- Logical volume "crs2" created [root@db1 ~]# lvcreate -n crs3 -L 2G data
- Logical volume "crs3" created [root@db1 ~]# lvcreate -n data -L 10G data
- Logical volume "data" created [root@db1 ~]# lvcreate -n fra -L 10G data
- Logical volume "fra" created
- [root@db1 ~]# lvs LV VG Attr LSize Origin Snap% Move Log Copy% Convert
- crs1 data -wi-a- 2.00G crs2 data -wi-a- 2.00G
- crs3 data -wi-a- 2.00G data data -wi-a- 10.00G
- fra data -wi-a- 10.00G
- [root@db1 ~]# service tgtd start Starting SCSI target daemon: [ OK ]
- [root@db1 ~]# cat iscsi.sh
- tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2012-07-04.com.yang.rac:crs1 tgtadm --lld iscsi --op new --mode target --tid 2 -T iqn.2012-07-04.com.yang.rac:crs2
- tgtadm --lld iscsi --op new --mode target --tid 3 -T iqn.2012-07-04.com.yang.rac:crs3 tgtadm --lld iscsi --op new --mode target --tid 4 -T iqn.2012-07-04.com.yang.rac:data
- tgtadm --lld iscsi --op new --mode target --tid 5 -T iqn.2012-07-04.com.yang.rac:fra
- tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/data/crs1 tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 2 -b /dev/data/crs2
- tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 3 -b /dev/data/crs3 tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 4 -b /dev/data/data
- tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 5 -b /dev/data/fra
- tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL tgtadm --lld iscsi --op bind --mode target --tid 2 -I ALL
- tgtadm --lld iscsi --op bind --mode target --tid 3 -I ALL tgtadm --lld iscsi --op bind --mode target --tid 4 -I ALL
- tgtadm --lld iscsi --op bind --mode target --tid 5 -I ALL
- [root@db1 ~]# tgtadm --lld iscsi -o show -m target [root@db1 ~]# sh iscsi.sh
- [root@db1 ~]# tgtadm --lld iscsi -o show -m target Target 1: iqn.2012-07-04.com.yang.rac:crs1
- System information: Driver: iscsi
- State: ready I_T nexus information:
- LUN information: LUN: 0
- Type: controller SCSI ID: deadbeaf1:0
- SCSI SN: beaf10 Size: 0 MB
- Online: Yes Removable media: No
- Backing store: No backing store LUN: 1
- Type: disk SCSI ID: deadbeaf1:1
- SCSI SN: beaf11 Size: 2147 MB
- Online: Yes Removable media: No
- Backing store: /dev/data/crs1 LUN: 2
- Type: disk SCSI ID: deadbeaf1:2
- SCSI SN: beaf12 Size: 2147 MB
- Online: Yes Removable media: No
- Backing store: /dev/data/crs2 LUN: 3
- Type: disk SCSI ID: deadbeaf1:3
- SCSI SN: beaf13 Size: 2147 MB
- Online: Yes Removable media: No
- Backing store: /dev/data/crs3 LUN: 4
- Type: disk SCSI ID: deadbeaf1:4
- SCSI SN: beaf14 Size: 10737 MB
- Online: Yes Removable media: No
- Backing store: /dev/data/data LUN: 5
- Type: disk SCSI ID: deadbeaf1:5
- SCSI SN: beaf15 Size: 10737 MB
- Online: Yes Removable media: No
- Backing store: /dev/data/fra Account information:
- ACL information: ALL
- Target 2: iqn.2012-07-04.com.yang.rac:crs2 System information:
- Driver: iscsi State: ready
- I_T nexus information: LUN information:
- LUN: 0 Type: controller
- SCSI ID: deadbeaf2:0 SCSI SN: beaf20
- Size: 0 MB Online: Yes
- Removable media: No Backing store: No backing store
- Account information: ACL information:
- Target 3: iqn.2012-07-04.com.yang.rac:crs3 System information:
- Driver: iscsi State: ready
- I_T nexus information: LUN information:
- LUN: 0 Type: controller
- SCSI ID: deadbeaf3:0 SCSI SN: beaf30
- Size: 0 MB Online: Yes
- Removable media: No Backing store: No backing store
- Account information: ACL information:
- Target 4: iqn.2012-07-04.com.yang.rac:data System information:
- Driver: iscsi State: ready
- I_T nexus information: LUN information:
- LUN: 0 Type: controller
- SCSI ID: deadbeaf4:0 SCSI SN: beaf40
- Size: 0 MB Online: Yes
- Removable media: No Backing store: No backing store
- Account information: ACL information:
- Target 5: iqn.2012-07-04.com.yang.rac:fra System information:
- Driver: iscsi State: ready
- I_T nexus information: LUN information:
- LUN: 0 Type: controller
- SCSI ID: deadbeaf5:0 SCSI SN: beaf50
- Size: 0 MB Online: Yes
- Removable media: No Backing store: No backing store
- Account information: ACL information: