Tuesday, April 5, 2016

Create & Attach Shared Disks On Multiple VMs in VirtualBox (On windows host)

Hi All,

Again after a gap of few months back again with a quick post on "How to create & attach shared disks on multiple VMs in VirtualBox). Shared storage is one of the primary requirements for implementing Oracle Real Application Clusters.

The code snippet shows how to :

1) List the existing HDDS
2) Create a shared HDD (In shareable mode)
3) Attach the newly created HDDs to multiple VMs

Note:- VBoxManage.exe is the executable that helps us in command line for carrying out tasks in VirtualBox.

C:\>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list hdds
UUID:           3326c82d-4a75-4f5a-a306-5762ec45db86
Parent UUID:    base
State:          locked write
Type:           normal (base)
Location:       C:\RAC11g\ajithn1\ajithn1.vdi
Storage format: VDI
Capacity:       30720 MBytes
Encryption:     disabled


C:\>E:

E:\RAC11g-shared>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" createhd --filename data.vdi --size 3328 --variant Fixed
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: d10ff02b-0f21-4122-a54e-68f80389e8f0

E:\RAC11g-shared>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" createhd --filename backup.vdi --size 3328 --variant Fixed
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: f1e7c05c-dc17-4261-858f-41a6fc52f5f2

E:\RAC11g-shared>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list hdds
UUID:           3326c82d-4a75-4f5a-a306-5762ec45db86
Parent UUID:    base
State:          locked write
Type:           normal (base)
Location:       C:\RAC11g\ajithn1\ajithn1.vdi
Storage format: VDI
Capacity:       30720 MBytes
Encryption:     disabled

UUID:           d10ff02b-0f21-4122-a54e-68f80389e8f0
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       E:\RAC11g-shared\data.vdi
Storage format: VDI
Capacity:       3328 MBytes
Encryption:     disabled

UUID:           f1e7c05c-dc17-4261-858f-41a6fc52f5f2
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       E:\RAC11g-shared\backup.vdi
Storage format: VDI
Capacity:       3328 MBytes
Encryption:     disabled


E:\RAC11g-shared>
---

Just cd to the directory where the shareable disks where created.

E:\RAC11g-shared>dir
 Volume in drive E is FreeAgent Drive
 Volume Serial Number is C8AE-1065

 Directory of E:\RAC11g-shared

04/05/2016  06:27 PM             .
04/05/2016  06:27 PM             ..
04/05/2016  06:29 PM     3,491,758,080 backup.vdi
04/05/2016  06:26 PM     3,491,758,080 data.vdi
               2 File(s)  6,983,516,160 bytes
               2 Dir(s)  75,166,945,280 bytes free

E:\RAC11g-shared>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" storageattach ajithn1 --storagectl "SATA" --port 1 --device 0 --type hdd --medium data.vdi --mtype shareable

E:\RAC11g-shared>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" storageattach ajithn1 --storagectl "SATA" --port 2 --device 0 --type hdd --medium backup.vdi --mtype shareable

E:\RAC11g-shared>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" storageattach ajithn2 --storagectl "SATA" --port 1 --device 0 --type hdd --medium data.vdi --mtype shareable

E:\RAC11g-shared>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" storageattach ajithn2 --storagectl "SATA" --port 2 --device 0 --type hdd --medium backup.vdi --mtype shareable

E:\RAC11g-shared>


HAPPY LEARNING!

No comments:

Post a Comment

Thanks for you valuable comments !