虚拟机VMware下 Oracle RAC环境添加磁盘
[font=SimSun, STSong]虚拟机VMware[font=SimSun, STSong]下 Linux redhat 5 Oracle 10g RAC[font=SimSun, STSong]环境添加共享磁盘
1. [font=SimSun, STSong]正常关闭虚拟机
2.[font=SimSun, STSong]编辑虚拟机,添加磁盘
[font=SimSun, STSong]主要步骤如下:
a.[font=SimSun, STSong]编辑虚拟机,添加磁盘
b.[font=SimSun, STSong]选择Hard Disk[font=SimSun, STSong],点击下一步
c.[font=SimSun, STSong]选择SCSI[font=SimSun, STSong]类型
d.[font=SimSun, STSong]指定磁盘容量0.1G,[font=SimSun, STSong]选择分配所有磁盘空间
e.[font=SimSun, STSong]指定磁盘文件vmdk[font=SimSun, STSong]名称及存放路径
f.[font=SimSun, STSong]指定磁盘文件名称、位置后,点击高级选项
g.[font=SimSun, STSong]选择该次添加磁盘的虚拟设备号SCSI 1:8([font=SimSun, STSong]按照已使用的顺序,本例中SCSI 1:7[font=SimSun, STSong]已被使用,之前共享scsi1:1[font=SimSun, STSong]、scsi1:2[font=SimSun, STSong]、scsi1:3[font=SimSun, STSong]、scsi1:4[font=SimSun, STSong]、scsi1:5[font=SimSun, STSong]、scsi1:6)[font=SimSun, STSong],选择independent[font=SimSun, STSong]、persistent
h.[font=SimSun, STSong]磁盘添加完成
[font=SimSun, STSong]注:scsi1:7[font=SimSun, STSong]已被使用
i.[font=SimSun, STSong]编辑虚拟机配置文件
[font=SimSun, STSong]打开虚拟机VMware[font=SimSun, STSong]配置文件.vmx[font=SimSun, STSong],本例虚拟机rac1[font=SimSun, STSong]节点的配置文件为Red Hat Linux.vmx[font=SimSun, STSong],下面几行为添加磁盘后自动生成
[i]scsi1:8.present = "TRUE"
[i]scsi1:8.fileName = "D:\Virtual Machines\raw_disk\vote3.vmdk"
[i]scsi1:8.mode = "independent-persistent"
[font=SimSun, STSong]手工添加下行:
scsi1:8.deviceType = "disk"
j.[font=SimSun, STSong]启动虚拟机
k.OS[font=SimSun, STSong]中查看刚才添加的磁盘
fdisk -l
……
Disk /dev/sdh: 107 MB, 107374080 bytes
64 heads, 32 sectors/track, 102 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk /dev/sdh doesn't contain a valid partition table
[font=SimSun, STSong]格式化刚才添加的磁盘/dev/sdh
[root@rac1 ~]# fdisk /dev/sdh
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-102, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-102, default 102):
Using default value 102
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[font=SimSun, STSong]为了配置刚才添加的磁盘为共享裸设备,通过udev[font=SimSun, STSong]编辑/etc/udev/rules.d/60-raw.rules
[font=SimSun, STSong]根据已有共享磁盘使用情况,添加如下内容:
ACTION=="add", KERNEL=="/dev/sdh1", RUN+="/bin/raw /dev/raw/raw7 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="113",RUN+="/bin/raw /dev/raw/raw7 %M %m"
[font=SimSun, STSong]编辑下一行为:
KERNEL=="raw[1-7]", WNER="oracle", GROUP="oinstall", MODE="640"
[font=SimSun, STSong]指定设备属主、组和权限
[font=SimSun, STSong]注Oracle RAC orc[font=SimSun, STSong]、votedisk[font=SimSun, STSong]权限如下:
For OCR device:
chmod 640
For Voting device:
chmod 644
For ASM disks used for OCR/Voting disk:
chmod 660
[font=SimSun, STSong]启动udev[font=SimSun, STSong]:
[root@rac1 ~]# start_udev
Starting udev: [ OK ]
[font=SimSun, STSong]查看刚才配置的raw device[font=SimSun, STSong]:
[root@rac1 ~]# ls -ltrh /dev/raw/
total 0
crw-r----- 1 oracle oinstall 162, 1 Nov 25 20:26 raw1
crw-r----- 1 oracle oinstall 162, 5 Nov 25 20:26 raw5
crw-r----- 1 oracle oinstall 162, 7 Nov 25 20:57 raw7
crw-r----- 1 oracle oinstall 162, 3 Nov 25 20:58 raw3
crw-r----- 1 oracle oinstall 162, 4 Nov 25 20:59 raw4
crw-r----- 1 oracle oinstall 162, 2 Nov 25 20:59 raw2
crw-r----- 1 oracle oinstall 162, 6 Nov 25 20:59 raw6
l.[font=SimSun, STSong]关闭另一节点虚拟机rac2
j.[font=SimSun, STSong]编辑rac2[font=SimSun, STSong]虚拟机配置文件.vmx
[font=SimSun, STSong]添加如下刚才在虚拟机rac1[font=SimSun, STSong]上配置的共享磁盘信息,内容如下:
scsi1:8.deviceType = "disk"
[i]scsi1:8.present = "TRUE"
[i]scsi1:8.fileName = "D:\Virtual Machines\raw_disk\vote3.vmdk"
[i]scsi1:8.mode = "independent-persistent"
[font=SimSun, STSong]编辑/etc/udev/rules.d/60-raw.rules[font=SimSun, STSong],添加如下:
ACTION=="add", KERNEL=="/dev/sdh1", RUN+="/bin/raw /dev/raw/raw7 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="113",RUN+="/bin/raw /dev/raw/raw7 %M %m"
[font=SimSun, STSong]修改下行如下:
KERNEL=="raw[1-7]", WNER="oracle", GROUP="oinstall", MODE="640"
[font=SimSun, STSong]启动udev[font=SimSun, STSong]:
[root@rac1 ~]# start_udev
Starting udev: [ OK ]
[font=SimSun, STSong]查看共享设备:
[root@rac2 ~]# ls -ltrh /dev/raw/
total 0
crw-r----- 1 oracle oinstall 162, 3 Nov 25 21:40 raw3
crw-r----- 1 oracle oinstall 162, 4 Nov 25 21:40 raw4
crw-r----- 1 oracle oinstall 162, 6 Nov 25 21:44 raw6
crw-r----- 1 oracle oinstall 162, 2 Nov 25 21:44 raw2
crw-r----- 1 oracle oinstall 162, 5 Nov 25 21:46 raw5
crw-r----- 1 oracle oinstall 162, 1 Nov 25 21:46 raw1
crw-r----- 1 oracle oinstall 162, 7 Nov 25 21:46 raw7
k.[font=SimSun, STSong]使用刚才配置的共享设备创建votedisk
[root@rac2 ~]# crsctl add css votedisk /dev/raw/raw7 -force
Now formatting voting disk: /dev/raw/raw7
successful addition of votedisk /dev/raw/raw7.
[font=SimSun, STSong]查看votedisk[font=SimSun, STSong]:
[root@rac2 ~]# crsctl query css votedisk
0. 0 /dev/raw/raw2
1. 0 /dev/raw/raw6
2. 0 /dev/raw/raw7
located 3 votedisk(s).
[font=SimSun, STSong]在rac1[font=SimSun, STSong]节点上查看votedisk[font=SimSun, STSong]:
[root@rac1 ~]# crsctl query css votedisk
0. 0 /dev/raw/raw2
1. 0 /dev/raw/raw6
2. 0 /dev/raw/raw7
located 3 votedisk(s).