Shared disk with VirtualBox

Here you can provide suggestions on how to improve the product, website, etc.
leoric
Posts: 1
Joined: 2. Jul 2009, 10:23
Primary OS: OpenSolaris 11
VBox Version: PUEL
Guest OSses: Win2003, RHEL 4

Shared disk with VirtualBox

Post by leoric »

I'm looking on migration from VmWare to VirtualBox. I had experimental Oracle RAC installation (2 Vmware nodes, 1 shared disk (OCFS2 formatted) for voting disk and OCR config. But I've read that feature request to implement shared disks in VirtualBox was declined. Are there some patches or other possibility to create shared disk with Virtual Box or I need to use alternative configuration such as nfs storage for OCR files or iSCSI shared storage?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Shared disk with VirtualBox

Post by Sasquatch »

You can use shared storage with VB, that is, hook up one VDI to two VMs, but you can't use the disk in both VMs at the same time. So essentially, it's dedicated shared storage. Not exactly what you probably want. The only way to be able to use the same data in two VMs at the same time, is as you suggested, by network share.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
djtomr941
Posts: 22
Joined: 7. Apr 2010, 20:27
Primary OS: Ubuntu 8.10
VBox Version: OSE other
Guest OSses: Windows, OEL

Re: Shared disk with VirtualBox

Post by djtomr941 »

Now that Oracle owns Vitual Box, is there any chance we can get shared disks similar to how VMWARE does it?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Shared disk with VirtualBox

Post by mpack »

djtomr941 wrote:Now that Oracle owns Vitual Box, is there any chance we can get shared disks similar to how VMWARE does it?
How does VMWare do it?
markea01
Posts: 1
Joined: 3. May 2010, 18:49
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Solaris

Re: Shared disk with VirtualBox

Post by markea01 »

VMWare allows the virtual machines to share virtual disks, such that you can build a shared disk cluster across virtual machines (like Solaris Cluster) where the cluster framework manages arbitration between the writers, or Oracle RAC where the DLM (Distributed Lock Manager) provides the same function. Basically, we need to be able to allow the virtual hard disks to be simultaneously attached to multiple virtual machines. If I try that today on version 3.1.6 r59351, I get an error when I try to start the second virtual machine:

"Failed to start the virtual machine <vmname>. Medium /Full/path/to/vdifile.vdi is locked for writing by another task.


Result Code:
VBOX_E_INVALID_OBJECT_STATE (0x80BB0007)"

One way might be to add another VBoxManage setextradata command that would "override" this checking for a specific VDI file. In that way, you could maintain the current behavior for the bulk of users who would never want to use this feature, but allow it for those who could use it. I was attempting to do just such a thing today (I added a bunch of virtual disks in the hope of running Oracle RAC between two virtual machines) but was disappointed to find that it is not allowed :(
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Shared disk with VirtualBox

Post by mpack »

Does VMWare not run each VM as an independant application? If so, I find it hard to understand how it can allow two applications to open the same file at the same time, both with write permission. They would have to be one application, and/or some kind of complicated interface agent would have to exist (similar to shared folders) to mediate write requests. This involves big changes to the VBox architecture... and I shudder to think of the support questions that would arise.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Shared disk with VirtualBox

Post by Sasquatch »

markea01 wrote:VMWare allows the virtual machines to share virtual disks, such that you can build a shared disk cluster across virtual machines (like Solaris Cluster) where the cluster framework manages arbitration between the writers, or Oracle RAC where the DLM (Distributed Lock Manager) provides the same function. Basically, we need to be able to allow the virtual hard disks to be simultaneously attached to multiple virtual machines.
These systems still rely on ONE system writing to the disk. There is one system that is responsible for the whole file system, all 'clustered' systems talk to this system for reads and writes, they don't write any data themselves.
If I try that today on version 3.1.6 r59351, I get an error when I try to start the second virtual machine:

"Failed to start the virtual machine <vmname>. Medium /Full/path/to/vdifile.vdi is locked for writing by another task.


Result Code:
VBOX_E_INVALID_OBJECT_STATE (0x80BB0007)"

One way might be to add another VBoxManage setextradata command that would "override" this checking for a specific VDI file. In that way, you could maintain the current behavior for the bulk of users who would never want to use this feature, but allow it for those who could use it. I was attempting to do just such a thing today (I added a bunch of virtual disks in the hope of running Oracle RAC between two virtual machines) but was disappointed to find that it is not allowed :(
This is perfectly normal, you can't use 1 hard drive in two systems simultaneously, there aren't the connections for it. You only have one IDE/SATA/SCSI port, how would you use that on more than 1 system? I really don't see why everyone is so fed up with this 'simultaneous' access thing.

Just think about the RAW Disk access. If you mount the hard drive or partition that you are using for a VM and write to it while the VM is running, the whole file system can and probably will get corrupted. So unless you want to loose all your data on the shared drive, it will not be done by VB. They don't want anyone complain to them that their software corrupted your data because you try to write to the same file/disk at the same time from two different sources (VMs).
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
fixedwheel
Volunteer
Posts: 1699
Joined: 13. Sep 2008, 02:18

Re: Shared disk with VirtualBox

Post by fixedwheel »

Sasquatch wrote: This is perfectly normal, you can't use 1 hard drive in two systems simultaneously, there aren't the connections for it. You only have one IDE/SATA/SCSI port, how would you use that on more than 1 system?
this can be done with normal SCSI, just assign other SCSI id than default 7 to the second host adapter. Fibrechannel and iSCSI SAN support that too
I really don't see why everyone is so fed up with this 'simultaneous' access thing.
failover e.g Oracle RAC need this, OCFS2 filesystem and other ones exist
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Shared disk with VirtualBox

Post by Sasquatch »

It's either 1 OS writing to the disk, or 1 piece of hardware that manages the writes to disk. Still no simultaneous write access by 2 OSses without some intervention. No matter how you explain it, having two VMs accessing one VDI at the same time is a disaster waiting to happen.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
fixedwheel
Volunteer
Posts: 1699
Joined: 13. Sep 2008, 02:18

Re: Shared disk with VirtualBox

Post by fixedwheel »

Sasquatch wrote:No matter how you explain it, having two VMs accessing one VDI at the same time is a disaster waiting to happen.
no matter how you argue, shared access is needed for failover installations like e.g. Oracle RAC where OCFS filesystem cares about.
It is possible doing with real SCSI bus hardware (even the classic one, not iSCSI alone) without any additional hardware required.

granted, thats nothing related to the average users need ... and setting up things like RAC in virtual IMHO lacks of some sense except for testing purpose
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Shared disk with VirtualBox

Post by Sasquatch »

That which you describe is a fail-over system. That means that both systems constantly communicate with each other about access to the disk. This can indeed be set up in a VM, but I think it will cause more problems in the end than that it is useful. The average user might not think about it and happily starts two or more VMs with a shared disk and end up loosing the data on it. I'm not particularly waiting for topics of that kind here.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
fixedwheel
Volunteer
Posts: 1699
Joined: 13. Sep 2008, 02:18

Re: Shared disk with VirtualBox

Post by fixedwheel »

Sasquatch wrote:That which you describe is a fail-over system. That means that both systems constantly communicate with each other about access to the disk.
yes, thats exactly what the OP wanted ;)
leoric wrote:I'm looking on migration from VmWare to VirtualBox. I had experimental Oracle RAC installation (2 Vmware nodes, 1 shared disk (OCFS2 formatted) for voting disk and OCR config. But I've read that feature request to implement shared disks in VirtualBox was declined. (...)
Sasquatch wrote:The average user (...) I'm not particularly waiting for topics of that kind here.
:mrgreen: i can feel with you, but IMO the OPs wish is justified
djtomr941
Posts: 22
Joined: 7. Apr 2010, 20:27
Primary OS: Ubuntu 8.10
VBox Version: OSE other
Guest OSses: Windows, OEL

Re: Shared disk with VirtualBox

Post by djtomr941 »

Here is an article that discusses setting up Oracle RAC with VMWARE.

VirtualBox cannot do this.

http://www.oracle-base.com/articles/10g ... VMware.php

Specifically

In the .vmx file (basically the config file that points to the disks) You set something like this

disk.locking = "FALSE"

You can then have both SCSI disks accessible to both VM's at the same time. SANS do this, VMWARE does this, SCSI and iSCSI can even do this. It's a block device. Oracle then uses a DLM but other cluster file systems have it too. They coordinate the reads and writes at the software level.

Also, this would be a big benefit to anyone trying to install virtualized RAC environments or anything with a clustered set of disks.

I bet there is a big demand inside of Oracle for something like this (especially the teams that work with the DB and RAC).

I would love to get rid of VMWARE workstation for virtualbox and this is the only thing keeping me (and many others I presume) from doing so.
djtomr941
Posts: 22
Joined: 7. Apr 2010, 20:27
Primary OS: Ubuntu 8.10
VBox Version: OSE other
Guest OSses: Windows, OEL

Re: Shared disk with VirtualBox

Post by djtomr941 »

Sasquatch wrote:That which you describe is a fail-over system. That means that both systems constantly communicate with each other about access to the disk. This can indeed be set up in a VM, but I think it will cause more problems in the end than that it is useful. The average user might not think about it and happily starts two or more VMs with a shared disk and end up loosing the data on it. I'm not particularly waiting for topics of that kind here.
VMWARE makes you go in the file and edit it so you know what you are doing. You could just make it a parameter setting so hardcore users like us could set it or you could add some kind of warning message that says this disk is currently opened in another VM, are you sure you want to boot this VM up? Yes or No with a check box that says never show this message again. Or when you create the disk have a check box that says if you want this to be a locked or not locked disk. Just thinking of safeguards you could build into the product. With more and more grid/clustered computing and more powerful desktops/laptops, this could be a feature with a lot of demand (there already is in the Oracle/RAC world).
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Shared disk with VirtualBox

Post by mpack »

djtomr941 wrote:you could add some kind of warning message that says this disk is currently opened in another VM, are you sure you want to boot this VM up? ... Just thinking of safeguards
I don't consider any of that to be safeguards. The questions would be gobbledegook to a novice user, hence no barrier at all. A warning is useless when the user doesn't feel alarm, and my suspicion is that a large number of people asking for this feature simply don't understand that it entails the potential loss of their own data.
Post Reply