OraMatt: YABAOracle

Yet Another Blog About Oracle

, , , , , ,

Add ASM Disks to VirtualBox

Thought I’d share some VBox goodness.

Adding additional disks to VBox is simple with the following scripts

From the VBox host:

#!/bin/bash

#
# Add ASM storage to a VBox Image
#


echo "How many ASM disks would you like to add? > "
read ASMDISK

echo "What is the name of the VBox would you like to add the storage to? >"
vboxmanage list vms
read VBOXNAME

for (( i = 1 ; i <= ${ASMDISK} ; i++ ))
do
VBoxManage createhd --filename asm$i.vdi --size 5120 --format VDI --variant Fixed 
VBoxManage storageattach ${VBOXNAME} --storagectl "SATA Controller" --port ${i} --device 0 --type hdd --medium asm${i}.vdi
done



# Start the VM and fdisk the new ASM disks
vboxmanage startvm ${VBOXNAME}

echo "Sleeping for 20 seconds"
sleep 20

Once the VBox guest is fired up ssh into the guest via port forwarding (you’re port forwarding aren’t you? )

#!/bin/bash


sudo fdisk /dev/sdb < fdisk_cmds
sudo fdisk /dev/sdc < fdisk_cmds
sudo fdisk /dev/sdd < fdisk_cmds
sudo fdisk /dev/sde < fdisk_cmds
sudo fdisk /dev/sdf < fdisk_cmds


sudo /etc/init.d/oracleasm configure < asm_config 

sudo /etc/init.d/oracleasm createdisk ASM1 /dev/sdb1
sudo /etc/init.d/oracleasm createdisk ASM2 /dev/sdc1
sudo /etc/init.d/oracleasm createdisk ASM3 /dev/sdd1
sudo /etc/init.d/oracleasm createdisk ASM4 /dev/sde1
sudo /etc/init.d/oracleasm createdisk ASM5 /dev/sdf1



sudo /etc/init.d/oracleasm listdisks

Here’s the fdisk_cmds that worked for me…

n
p
1


w

Here’s the ASM commands that worked (you’re using ASM right…?)

oracle
dba
y
y

Now you’re all set to start installing your Grid Infrastructure on your VBox guest.

BTW…you might need to change the disk discovery path in the ASM config wizard to either “ORCL:*” or “/dev/oracleasm/disks/*”

Cheers,
Matt

Credit:
I basically bastardized this great HOW-TO

Leave a comment

Navigation

About

I’m Matt and I do Oracle things.