This may be the wrong topic since I'm working on Windows 7 with VirtualBox and my VM is an Ubuntu 17.
I'm trying to share a directory between my Windows and my Ubuntu.
This works fine with these steps :
- In VirtualBox > Devices > Shared Folders : I add a share
- Folder path : my directory on Windows (ie : C:\dev\windows-shared)
- Folder name : vbox_shared
- And I check "Auto-mount" and "Make Permanent"
Now, in a terminal in Ubuntu, I run :
sudo mount -t vboxsf vbox_shared /home/osboxes/ubuntu-shared
And it works : I can add a file in Windows and see it in Ubuntu and vice versa.
The problem is if my "ubuntu-shared" directory already contains files : after the mount
command, the directory is "empty" (and the directory is now under root:root).
If I umount
, files in the directory are back (of course).
So : 1) is there a way to mount on an existing (not empty) directory without "losing" its content ? or 2) less ubuntu relative : is there a better way to share a folder on VirtualBox ?
Thanks !
EDIT - SOLVED :
As found in Error mounting VirtualBox shared folders in an Ubuntu guest, the correct command to run in the terminal should be:
sudo mount -t vboxsf -o uid=1000,gid=1000 vbox_shared /home/osboxes/ubuntu-shared
where the option -o makes sure that you will have access to the mount (that will otherwise be owned by root)."