0

I'm running Windows 10 & Ubuntu dual-boot, and would like to also use VirtualBox to boot to the Windows installation as a VM from within Ubuntu (to avoid a full reboot to just do something quick). This is pretty common & well-documented - i.e. here. However, a caveat that I sometimes see mentioned is:

"[if] you open the same partition twice [...] this will kill your data, so never mount multiple partitions concurrently. Furthermore, don't mount your NTFS partitions while they are used by your Windows." (From: here)

My system is setup where I have a shared NTFS partition for data common to both Linux & Windows. Obviously when dual-booting, this works fine: I can access the same set of data from whichever OS is up & running. So for the VM scenario to be useful, both OSs would similarly need access to this "shared data" partition. VirtualBox usually handles shared storage by mapping network drives into the VM, but there are many cases where this doesn't work. Some examples: Lightroom doesn't let you open a catalog on a network drive; many applications won't let you open a database on a network drive or use a network drive for temp; Windows complains when running some applications directly off a network drive. Thus, to be useful, both OSs need direct access to this "shared data" partition.

So my question: am I understanding correctly in that this is somehow unsafe - to directly mount this NTFS partition from both OSs? If so, why? And is there any possible solution to what I'm trying to accomplish - or no, I just have to either dual boot, or copy all the problematic data (i.e. LR catalog) back & forth onto the VM's system disk for it to work (which pretty much defeats the purpose of using the VM - at that point it's more efficient to just fully reboot in Windows)

J23
  • 201
  • 4
  • 10
  • There's a Biblical saying: You cannot server two masters. Likewise a filesystem cannot be modified by two hosts without eventual corruption. It is a simple problem of [contention](https://en.wikipedia.org/wiki/Resource_contention) and the lack of exclusive access (i.e. a lock mechanism). – sawdust Jun 14 '20 at 20:02
  • In theory though, why wouldn't it be OK as long as I don't simultaneously write to the same file from both? Or is that the very problem - the fact that there's no "master" keep track of it, so it's up to the user to be sure they don't make the mistake of writing to the same file from both places? – J23 Jun 14 '20 at 22:43
  • No, your theory and understanding are too simplistic. The entire partition with the filesystem would end as the shared resource, not just one file. Each OS assumes that it has exclusive access to the partition, and can (and will) do whatever and whenever as it chooses. The user has no control of when *"writing"* actually occurs (unless explicit synchronization is invoked for the filesystem as well as the storage device). – sawdust Jun 15 '20 at 01:23
  • There are schemes for "sharing" a filesystem. A filesystem is accessible (e.g. over a network) using an API that is provided by the host OS. – sawdust Jun 15 '20 at 01:32
  • Understood - so I guess that confirms that it's definitely unsafe & why. The final question then, more broadly speaking, is there any way to accomplish what I'm trying to do? Again, because VBox presents the "shared" drive as a network resource, it's a bit too functionally crippled to do many things (i.e. can't open a LR catalog, can't directly open databases, etc). Is there basically no way to do what I'm hoping - so I just have to manually keep copying the data back & forth from the "shared" drive into the VM (thus eliminating the time saved by not just rebooting all the way into Windows)? – J23 Jun 15 '20 at 03:15

0 Answers0