分區,並使用udev來配置裸設備


原文出處:http://blog.csdn.net/rlhua/article/details/21862135
分區,並使用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 ~]# 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM