# 在Windows系统下,创建目录F:\VirtualBoxImage\ShareDisk(找个磁盘空间大的分区,而且目录要在现存虚拟机目录之外)
# 设置Windows环境变量PATH,添加VirtualBox软件的安装路径,C:\Program Files\Oracle\VirtualBox
# 关闭ol6-112-rac1结点,关闭VirtualBox
$ poweroff
# Windows DOS进入到ShareDisk目录执行下面的命令, 创建共享磁盘
VBoxManage createhd --filename asm1.vdi --size 5120 --format VDI --variant Fixed
VBoxManage createhd --filename asm2.vdi --size 5120 --format VDI --variant Fixed
VBoxManage createhd --filename asm3.vdi --size 5120 --format VDI --variant Fixed
VBoxManage createhd --filename asm4.vdi --size 5120 --format VDI --variant Fixed
# 设置VirtualBox(这步现在不需要做)
# 将创建的共享磁盘连接到ol6-112-rac1虚拟机
VBoxManage storageattach ol6-112-rac1 --storagectl "SATA" --port 1 --device 0 --type hdd --medium asm1.vdi --mtype shareable
VBoxManage storageattach ol6-112-rac1 --storagectl "SATA" --port 2 --device 0 --type hdd --medium asm2.vdi --mtype shareable
VBoxManage storageattach ol6-112-rac1 --storagectl "SATA" --port 3 --device 0 --type hdd --medium asm3.vdi --mtype shareable
VBoxManage storageattach ol6-112-rac1 --storagectl "SATA" --port 4 --device 0 --type hdd --medium asm4.vdi --mtype shareable
# 创建之后打开VirtualBox查看设置情况
# 设置磁盘共享
VBoxManage modifyhd asm1.vdi --type shareable
VBoxManage modifyhd asm2.vdi --type shareable
VBoxManage modifyhd asm3.vdi --type shareable
VBoxManage modifyhd asm4.vdi --type shareable
# 启动ol6-112-rac1, 以root用户登录, 查看和格式化共享磁盘
root@ol6-112-rac1.cuug.net:/root>$ cd /dev
root@ol6-112-rac1.cuug.net:/dev>$ ls sd*
sda sda1 sda2 sdb sdc sdd sde
# 对sdb进行格式化
root@ol6-112-rac1.cuug.net:/dev>$ fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xab3d216f.
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)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-652, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652):
Using default value 652
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# 采用同样的步骤对sdc、sdd、sde进行格式化
# 查看格式化后的结果
root@ol6-112-rac1.cuug.net:/dev>$ ls sd*
sda sda1 sda2 sdb sdb1 sdc sdc1 sdd sdd1 sde sde1
# 参考《Oracle Linux 5和6 ASM的UDEV SCSI规则配置》配置UDEV规则
# 编辑/etc/scsi_id.config,添加下面的行, 来配置SCSI设备受信
options=-g
# 我的磁盘的SCSI ID
root@ol6-112-rac1.cuug.net:/root>$ /sbin/scsi_id -g -u -d /dev/sdb
1ATA_VBOX_HARDDISK_VB169821f9-778f17a9
root@ol6-112-rac1.cuug.net:/root>$ /sbin/scsi_id -g -u -d /dev/sdc
1ATA_VBOX_HARDDISK_VB11054d10-fef7afc0
root@ol6-112-rac1.cuug.net:/root>$ /sbin/scsi_id -g -u -d /dev/sdd
1ATA_VBOX_HARDDISK_VB5d080c93-ecb43774
root@ol6-112-rac1.cuug.net:/root>$ /sbin/scsi_id -g -u -d /dev/sde
1ATA_VBOX_HARDDISK_VBbf89874f-11be66ae
# 编辑/etc/udev/rules.d/99-oracle-asmdevices.rules文件添加下面的内容,每于每个entry的所有参数必须位于同一行
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VB169821f9-778f17a9", NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VB11054d10-fef7afc0", NAME="asm-disk2", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VB5d080c93-ecb43774", NAME="asm-disk3", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VBbf89874f-11be66ae", NAME="asm-disk4", OWNER="oracle", GROUP="dba", MODE="0660"
# 加载更新的块设备的分区表
root@ol6-112-rac1.cuug.net:/root>$ /sbin/partprobe /dev/sdb1
root@ol6-112-rac1.cuug.net:/root>$ /sbin/partprobe /dev/sdc1
root@ol6-112-rac1.cuug.net:/root>$ /sbin/partprobe /dev/sdd1
root@ol6-112-rac1.cuug.net:/root>$ /sbin/partprobe /dev/sde1
# 测试规则正常工作
root@ol6-112-rac1.cuug.net:/root>$ /sbin/udevadm test /block/sdb/sdb1
# 重新加载UDEV规则和启动UDEV
root@ol6-112-rac1.cuug.net:/root>$ /sbin/udevadm control --reload-rules
root@ol6-112-rac1.cuug.net:/root>$ /sbin/start_udev
Starting udev: [ OK ]
# 查看磁盘可见并且具有正确的所有者关系.如果不可见,则说明UDEV配置不正确,需要进行重新配置
root@ol6-112-rac1.cuug.net:/root
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/17013648/viewspace-1078705/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/17013648/viewspace-1078705/