0
votes

I have VirtualBox installed in my windows host machine and I have installed Ubuntu in VirtualBox. I created a folder in windows to share it with Ubuntu, the folder in windows is located in D:/webroot and in Ubuntu it is /web.

So I followed this tutorial How To - Create Shared folder in Ubuntu under Virtual Box and basically I created a new shared folder in windows, created a file /etc/rc.local and I put in it this code:

sudo mount -t vboxsf -o uid=33,gid=33 Webroot /web/
exit 0

then I run these as specified in the tutorial:

sudo mount /dev/cdrom /mnt
cd /mnt
sudo ./VBoxLinuxAdditions.run
sudo reboot

I can see that it works, if I create a file inside /web or D:/webroot it reflects on both sides but the problem is, as soon as I set this sharing system, the entire content of the folder /web in Ubuntu is cleared. This is a problem because I tried with sharing the apache files location in /var/www/ and I ended up with all html files deleted when I start sharing that folder?

Is this a normal behavior for sharing files in VirtualBox, does this mean that sharing is done first from host to guest, that is why Ubuntu folder is cleared because the windows folder is empty or am I missing something here please?

Thanks.

1

1 Answers

0
votes

Nothing in the shared-folder system should erase any file for any reason! There must be a problem somewhere in some application code.

Now ... you say that the folder in Ubuntu is "emptied." What does it actually look like on the host side? All Linux/Unix "mounts" occur at a particular point in the local file-system ... an empty directory, say, in /mnt. When a filesystem is mounted, you see the contents there. But, if a filesystem is not mounted there, you see the (empty) directory. Use the mount command to determine if, in fact, the shared filesystem is still mounted.

My hypothesis is correct if you see an empty folder on the Ubuntu (guest) side, but the folder is not actually empty on the host. On the other hand, if the host directory is being erased, "you have a bug somewhere [else]."