OCM_Session7_8_分区,并使用udev来配置裸设备

 

八,分区,并使用udev来配置裸设备。

接下来启动,然后分区:
这里在每个磁盘上分别创建1个分区,且把磁盘所有空间都用于这1个主分区。
对共享磁盘分区时,只需要以root用户在任意节点上创建即可,不需要在每个节点上执行!

--------------------------------------------------------------------------------------------------

1.查看各节点磁盘的信息。

节点2上的磁盘分区信息除/dev/sda可能不同之外,其它共享磁盘分区信息应该完全同节点1。
rac1节点

[root@rac1 ~]# fdisk -l

Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        6266    50227222+  83  Linux
/dev/sda3            6267        6527     2096482+  82  Linux swap / Solaris

Disk /dev/sdb: 136 MB, 136314880 bytes
255 heads, 63 sectors/track, 16 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sdc: 136 MB, 136314880 bytes
255 heads, 63 sectors/track, 16 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table

Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdd doesn't contain a valid partition table

Disk /dev/sde: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sde doesn't contain a valid partition table
[root@rac1 ~]# 
-------------------------------------------------------------------------------------
rac2节点

[root@rac2 ~]# fdisk -l

Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        6266    50227222+  83  Linux
/dev/sda3            6267        6527     2096482+  82  Linux swap / Solaris

Disk /dev/sdb: 136 MB, 136314880 bytes
255 heads, 63 sectors/track, 16 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sdc: 136 MB, 136314880 bytes
255 heads, 63 sectors/track, 16 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table

Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdd doesn't contain a valid partition table

Disk /dev/sde: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sde doesn't contain a valid partition table
[root@rac2 ~]# 




--------------------------------------------------------------------------------------------------

2.我这里在rac1节点上分区,执行fdisk /dev/sdb,--fdisk /dev/sdc,--fdisk /dev/sdd,--fdisk /dev/sde


[root@rac1 ~]#   fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help):   n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4):   1
First cylinder (1-16, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-16, default 16): 
Using default value 16

Command (m for help):   w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

需要你输入的依次是"n/p/1/回车/回车/w"。
就本RAC而言,需要我们进行分区的有 4 个:sdb,sdc,sdd,sde

------------------------------------------------------------------------------------------------

3.查看在rac1和rac2节点看分区后的结果

rac1节点

[root@rac1 ~]# fdisk -l

Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        6266    50227222+  83  Linux
/dev/sda3            6267        6527     2096482+  82  Linux swap / Solaris

Disk /dev/sdb: 136 MB, 136314880 bytes
255 heads, 63 sectors/track, 16 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          16      128488+  83  Linux

Disk /dev/sdc: 136 MB, 136314880 bytes
255 heads, 63 sectors/track, 16 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1          16      128488+  83  Linux

Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1         391     3140676   83  Linux

Disk /dev/sde: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1         391     3140676   83  Linux
[root@rac1 ~]# 
---------------------------------------------------------------------------------

rac2节点

[root@rac2 ~]# fdisk -l

Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        6266    50227222+  83  Linux
/dev/sda3            6267        6527     2096482+  82  Linux swap / Solaris

Disk /dev/sdb: 136 MB, 136314880 bytes
255 heads, 63 sectors/track, 16 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          16      128488+  83  Linux

Disk /dev/sdc: 136 MB, 136314880 bytes
255 heads, 63 sectors/track, 16 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1          16      128488+  83  Linux

Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1         391     3140676   83  Linux

Disk /dev/sde: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1         391     3140676   83  Linux
[root@rac2 ~]# 

-------------------------------------------------------------------------
4.查看各节点信息。

rac1节点

[root@rac1 ~]# ll /dev/sd*
[root@rac1 ~]#  ll /dev/sd*
brw-r----- 1 root disk 8,  0 Mar 22 11:06 /dev/sda
brw-r----- 1 root disk 8,  1 Mar 22 11:08 /dev/sda1
brw-r----- 1 root disk 8,  2 Mar 22 11:08 /dev/sda2
brw-r----- 1 root disk 8,  3 Mar 22 11:06 /dev/sda3
brw-r----- 1 root disk 8, 16 Mar 22 11:15 /dev/sdb
brw-r----- 1 root disk   8, 17  Mar 22 11:15 /dev/sdb1
brw-r----- 1 root disk 8, 32 Mar 22 11:15 /dev/sdc
brw-r----- 1 root disk   8, 33  Mar 22 11:15 /dev/sdc1
brw-r----- 1 root disk 8, 48 Mar 22 11:16 /dev/sdd
brw-r----- 1 root disk   8, 49 Mar 22 11:16 /dev/sdd1
brw-r----- 1 root disk 8, 64 Mar 22 11:16 /dev/sde
brw-r----- 1 root disk   8, 65 Mar 22 11:16 /dev/sde1

这里查看配置裸设备需要的 MAJOR和 MINOR,如/dev/sdb1的 ENV{MAJOR}=="8",ENV{MINOR}=="17"

查案rac2节点
[root@rac2 ~]#  ll /dev/sd*
brw-r----- 1 root disk 8,  0 Mar 22 11:07 /dev/sda
brw-r----- 1 root disk 8,  1 Mar 22 11:11 /dev/sda1
brw-r----- 1 root disk 8,  2 Mar 22 11:11 /dev/sda2
brw-r----- 1 root disk 8,  3 Mar 22 11:07 /dev/sda3
brw-r----- 1 root disk 8, 16 Mar 22 11:07 /dev/sdb
brw-r----- 1 root disk 8, 32 Mar 22 11:07 /dev/sdc
brw-r----- 1 root disk 8, 48 Mar 22 11:07 /dev/sdd
brw-r----- 1 root disk 8, 64 Mar 22 11:07 /dev/sde
---------------------------------------------------------------------------------------------------

5.配置裸设备

上述操作需要在双节点执行!且确保在双节点均可以看到裸设备文件,以及oracle用户具有对裸设备的权限

ACTION=="add", KERNEL=="/dev/sdb1",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="17",RUN+="/bin/raw /dev/raw/raw1 %M %m"
ACTION=="add", KERNEL=="/dev/sdc1",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="33",RUN+="/bin/raw /dev/raw/raw2 %M %m"
ACTION=="add", KERNEL=="/dev/sdd1",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="49",RUN+="/bin/raw /dev/raw/raw3 %M %m"
ACTION=="add", KERNEL=="/dev/sde1",RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="65",RUN+="/bin/raw /dev/raw/raw4 %M %m"

KERNEL=="raw[1-4]", OWNER="oracle", GROUP="oinstall", MODE="640"
----------------------------------------------------------------------------------------------------------------

在rac1节点执行
[root@rac1 ~]#   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=="/dev/sdb1",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="17",RUN+="/bin/raw /dev/raw/raw1 %M %m"
ACTION=="add", KERNEL=="/dev/sdc1",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="33",RUN+="/bin/raw /dev/raw/raw2 %M %m"
ACTION=="add", KERNEL=="/dev/sdd1",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="49",RUN+="/bin/raw /dev/raw/raw3 %M %m"
ACTION=="add", KERNEL=="/dev/sde1",RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="65",RUN+="/bin/raw /dev/raw/raw4 %M %m"

KERNEL=="raw[1-4]", OWNER="oracle", GROUP="oinstall", MODE="640"
~
~
~
~
"/etc/udev/rules.d/60-raw.rules" 18L, 991C written
[root@rac1 ~]#   start_udev
Starting udev: [  OK  ]
[root@rac1 ~]#   ll /dev/raw/*
crw-r----- 1 oracle oinstall 162, 1 Mar 22 11:24 /dev/raw/raw1
crw-r----- 1 oracle oinstall 162, 2 Mar 22 11:24 /dev/raw/raw2
crw-r----- 1 oracle oinstall 162, 3 Mar 22 11:24 /dev/raw/raw3
crw-r----- 1 oracle oinstall 162, 4 Mar 22 11:24 /dev/raw/raw4
[root@rac1 ~]# 
--------------------------------------------------------------------------------------------------


在rac2节点执行

[root@rac2 ~]#  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=="/dev/sdb1",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="17",RUN+="/bin/raw /dev/raw/raw1 %M %m"
ACTION=="add", KERNEL=="/dev/sdc1",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="33",RUN+="/bin/raw /dev/raw/raw2 %M %m"
ACTION=="add", KERNEL=="/dev/sdd1",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="49",RUN+="/bin/raw /dev/raw/raw3 %M %m"
ACTION=="add", KERNEL=="/dev/sde1",RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="65",RUN+="/bin/raw /dev/raw/raw4 %M %m"

KERNEL=="raw[1-4]", OWNER="oracle", GROUP="oinstall", MODE="640"
~
~
~
~
~
~
~
~
~
"/etc/udev/rules.d/60-raw.rules" 18L, 991C written
[root@rac2 ~]#   start_udev
Starting udev: [  OK  ]
[root@rac2 ~]#  ll /dev/raw/*
crw-r----- 1 oracle oinstall 162, 1 Mar 22 11:10 /dev/raw/raw1
crw-r----- 1 oracle oinstall 162, 2 Mar 22 11:10 /dev/raw/raw2
crw-r----- 1 oracle oinstall 162, 3 Mar 22 11:10 /dev/raw/raw3
crw-r----- 1 oracle oinstall 162, 4 Mar 22 11:10 /dev/raw/raw4
[root@rac2 ~]# 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------


 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值