Page 1 of 1

"folder sharing" vs. shared partitions?

Posted: 26. Oct 2009, 04:55
by wamanning
what is wrong with both the host and vm simply accessing the same partition?

i.e., both linux host and vista vm accessing /dev/hdb1 with read/write access?

i mean, it works - i'm doing it now and i didnt set up anything w/ the "shared folders" feature in vbox...is there some downside to this approach?

i would think the host os controls all read/write actions to the partition in question, and will know how to deal with concurrent requests that come from the vm and lock it out if the host has a file open/locked (or vice versa if the vm has a file opened/locked).

i found this thread...which touches on the topic...http://forums.virtualbox.org/viewtopic. ... are#p44557

i probably need to double-check to see if both the host and vm mounting/accessing teh same partition is actually allowing read/write from the vm on my machine. i did see files, but didnt check the writing to the filesystem.

Re: "folder sharing" vs. shared partitions?

Posted: 26. Oct 2009, 08:36
by MarkCranness
Do not test your idea on a partition that has data you want to keep, because you likely will lose that data!

With raw disks, the guest accesses the drive sectors directly, and the host does not know about which files the guest is writing, and cannot arbitrate file locks etc. It may seem that it worked for you, but sooner or later (probably sooner) the partition will be currupted.

Imagine it like so: A whiteboard. Two people with marker pens. In your test, one person went up to the whiteboard, made a mark top-left, then stepped back. The other person walked up the board, saw the first person's mark and made another mark top-right then stepped back. Remember that OSs cache disk data in memory so that they dont always have to read the disk to see what a sector says. Suppose the second person had not looked at the actual whiteboard, but had remembered (in their cache) that there was free space at the top-left, and just written there: they would overwrite the first person's mark. Imagine both people get really busy transcribing a speech and both try and write on the whiteboard ignoring the other's marks: total rubbish on the whiteboard.

Re: "folder sharing" vs. shared partitions?

Posted: 26. Oct 2009, 12:47
by mpack
wamanning wrote:i mean, it works - i'm doing it now and i didnt set up anything w/ the "shared folders" feature in vbox...is there some downside to this approach?
Yes, this has a small downside - instant corruption when both sides write to the partition, the obvious effects perhaps delayed until both sides have flushed any cached metadata, eg. the used cluster map. You should immediately stop doing this, then run a thorough disk check with the host OS. Hopefully the damage is recoverable.