Making existing VDI disk shareable

This is for discussing general topics about how to use VirtualBox.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Making existing VDI disk shareable

Post by scottgus1 »

Just in case, Mjf, you come back wondering what someone else has posted, I have an idea that could get you to your desired destination without the risky "shared" disk usage you are being warned against. (I might have missed this idea above, sorry if I did)

You want more than one guest to be able to access a single repository of data. You don't want that data on your host as a shared folder. Fair enough. Use a shared folder in another guest, and use Internal Networking to connect the guests.

Get a low-impact Linux, like a NAS OS maybe, attach your repository VDI to the NAS guest, and share a folder on the repository VDI. Attach the guests together on one Virtualbox Internal network and give each guest a static IP address, or if you want the host in the network too, use the same Host Only network on each guest (the NAS guest will probably need a static IP either way, just use one of the any applicable ranges if you use internal, or use the range picked by the Host-only).
mjf
Posts: 25
Joined: 7. Aug 2014, 14:36

Re: Making existing VDI disk shareable

Post by mjf »

Thanks for your suggestion, scottgus1. I guess sharing folders among guests is much faster than e.g. using NFS?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Making existing VDI disk shareable

Post by scottgus1 »

I'm not certain, myself, I'm not much of a Linux guy. PerryG might be able to weigh in if he sees this.
If NFS (had to google it, apparently "Network File System") is one of those things Linux can set up, just try it and see what you get.
But letting one guest act as a server for other guests is probably going to be the way you need to solve your problem.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Making existing VDI disk shareable

Post by socratis »

Also, be aware that shared folders in VirtualBox present a very simplified file system implementation, just enough to read/write files quick and dirty. Many applications can error when using shared folders, because they expect advanced features, like file locking or access controls, which don't exist for shared folders. You should definitely take that into account.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Making existing VDI disk shareable

Post by scottgus1 »

Socratis is referring to Guest Additions Shared Folders, which can be made without having any network in the guest. Guest Additions Shared Folders are really only for file copying, not for running programs, databases, etc. You will want to set up a complete Virtualbox network with virtual NICs and an internal or host-only network, and whatever real shared folders Linux OS's can make when there's a network in place, for full file system activity.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Making existing VDI disk shareable

Post by Perryg »

First off shared disks are not the way to go for most. The image is read only and can not be written to when the guest reboots and is only doable as a fixed disk which is not the default format. I would really like to know the use case here before I give any advise.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Making existing VDI disk shareable

Post by scottgus1 »

Hey there, Perry! Mjf was asking if a "shared" drive could be attached to multiple guests as a central depository for data all the guests would use. He was warned off the idea. I suggested using another NAS-like low-impact guest as a server with shared folders that other guests would access over an internal or host-only network. I called up your name regarding the question mjf had about using NFS as opposed to regular shared folders.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Making existing VDI disk shareable

Post by Perryg »

It would all depend on what the share is. Is it data or is it the actual guest? Shared data would work in NSF and might work with shared folder, but I have never tried it myself. The real issue would be what happens if two or more entities were writing to the share at the same time. My preference would be data and NFS as that is not only doable but the preferred way with Linux.
mjf
Posts: 25
Joined: 7. Aug 2014, 14:36

Re: Making existing VDI disk shareable

Post by mjf »

The initial suggestion was to use shared folders on the host. Now it sounds a bit as if there might be a potential problem with simultaneous writes to files in shared folders as well. Does VirtualBox handle concurrent access to shared folders by multiple VMs?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Making existing VDI disk shareable

Post by socratis »

mjf wrote:Does VirtualBox handle concurrent access to shared folders by multiple VMs?
Does your operating system handle concurrent access to files/folders by multiple processes?

Hint: Not, unless there is a special setup, a referee or a "traffic cop". The networking route of NFS that was suggested has a built-in traffic cop. Specialized programs (databases come in mind) have a built-in traffic cop. VirtualBox does not.

So, don't try to fit a square peg in a round hole. Use existing tools that have been known to work well. Take an example from the physical world and apply it to the virtual. How would you setup the whole thing if we were talking about multiple PCs and not VMs? That's what you should be focusing on.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
mjf
Posts: 25
Joined: 7. Aug 2014, 14:36

Re: Making existing VDI disk shareable

Post by mjf »

What makes you think that I want to use shared folders on the host?

Why don't you answer my question with a simple "no"? The fact that a given OS does not support concurrent file access does not mean that VirtualBox can't implement it for shared folders.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Making existing VDI disk shareable

Post by socratis »

A fellow user recently reminded me:
  • As people sometimes say, if you define a problem no one else has, you also have to figure out the solution no one else cares for.
mjf wrote:The fact that a given OS does not support concurrent file access does not mean that VirtualBox can't implement it for shared folders.
You were looking for simple answers: No.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Making existing VDI disk shareable

Post by scottgus1 »

mjf wrote:Does VirtualBox handle concurrent access to shared folders by multiple VMs
Virtualbox makes the network. The guest OS's decide how to handle files they can access over a real network shared folder.

If I and a co-worker both open a text file in Notepad on a shared folder, we are both allowed to edit, but whoever saves last gets the final version. A 3D modelling program we run uses databases which allow changes from several users at once. When my co-worker opens a MS Word or AutoCAD document, I can't open directly, but I can open read-only.

It's all up to how the programs running on the client PCs are designed to multi-access files on the server.

Don't over-think the Virtualbox side of things. You mentioned you don't want the shared files on the host, that's fine. Just set up a NAS-like guest to handle a shared folder, put your data in it, set all the guests to connect to the same Virtualbox internal or host-only network, and access the NAS's shared folder in the other development guests. If the development programs have any glitches accessing the data simultaneously, then the programs need to be investigated with their developers. The same issue would have happened if you were able to use a shared disk as you wanted to in the beginning, or if you had all physical PCs and a real wired network & router.
Post Reply