I run Ubuntu 16 Desktop as host and on VirtualBox running Ubuntu 16 Server as guest which is using raw partition on another disk different from the one used by the host.

I am searching for a solution which will allow me to have safe read-write access to the guest's FS (or at least to some directory on the guest partition!). I'd like to know for each opportunity even if it will sacrifice some ext4 features (security/performance) and will result in actually unsafe FS on the guest side.

I am not experienced in the Unix environment but I guess that it is achievable trough proper mounting configuration for the host partition (from fstab) and proper root mounting on the guest side.

I have tried by mounting on both sides with "defaults" option but when I create file from the host it is not showing on the guest FS, however it is read-write accessible from the host! When file is edited it is not actually reflecting on the guest.

  • 1
    Can you describe the underlying problem you want to solve? Usually sharing between a live guest VM and the host is done by either a network mount of a filesystem or by using the "shared directory" feature of the VM software. Which one to use depends on which user (the guest VM or the host) needs faster access. – Mark Plotnick Aug 21 '16 at 21:31
  • I'd like to use that configuration to increase the performance and that way the productivity of my development process. I have big projects with source of 40,000+ files and using IDE software to work with the source code. GIT is used too. These things require high I/O, like the speed which can be achieved by SSDs and that is why I am escaping of the network solutions. In the same time I want the web server to be able to read the source document root in order to prevent source on two places, I have to avoid the need to have syncing. I need fast access in both directions. – kanevbgbe Aug 22 '16 at 4:41

Don't do this...

If two operating systems try to access the same raw block device at the same time then you should expect to see data corruption. Even if one of them is read-only, that read-only instance will cache data (eg directory contents, file contents) and won't know that the underlying data blocks have changed. At best this may result in perceived corruption inside the OS; at worst this may cause the OS to treat the filesystem as bad. If both OSes have write access to the device then the worst case scenerio is that you can expect the filesystem itself to be corrupted.

(There are some filesystems that will allow multi-server access, but they are not common).

Instead you should have one OS access the block device and then NFS export this to the other OS, which can then mount the filesystem over the network.

  • Thanks for the explanation. Is there a way to disable the caching mechanism of ext4 (will do it on the guest) in order to prevent these failures? I can create additional partition on the guest which will be accessed from the host as ext4 and the root partition of the guest will not be mounted actually for the host in order to prevent guest OS corruption. – kanevbgbe Aug 21 '16 at 17:37
  • Not that I know of; but even if there was then it wouldn't help because there's no "locking" and so a read inside the guest could still return inconsistent results if the parent was in the middle of writing data. There's inherent race conditions involved. – Stephen Harris Aug 21 '16 at 18:06
  • I will go outside of the main topic but is it than possible to use Linux container to achieve the same thing? AFAIK the container will use the Ubuntu Desktop kernel but everything else will be isolated, everything inside the container will look as a separate machine (is that right?), is it actually possible for the container to be like the server edition? I just found about the containers from your blog and have a little knowledge on that. For now I am considering to mark your post as answer but I will wait for the discussion to go to the end. Thanks! – kanevbgbe Aug 21 '16 at 19:02
  • A container may not necessarily have access to a video device so a desktop version may not make sense. I've not used containers to run desktop OSes; I'm mostly focused on server side stuff. For a server OS with a non-GUI console then we can make a container look close to a native OS build; there are differences (eg shared kernel, some devices may not be available, some lower level stuff may not work). But a server container could then share a filesystem with the parent (eg docker with the -v option). – Stephen Harris Aug 21 '16 at 19:08

step 1: Restart your pc go to bios menu find virtualization and enable it Step 2: save that it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.