Link to home
Start Free TrialLog in
Avatar of Peter Chan
Peter ChanFlag for Hong Kong

asked on

Issue of shared path

Hi,

Ubuntu guest VM is having Host-Only adapter and I can ping the IP 192.168.56.101 of this Guest VM, from the host.

This VM is having one shared path like

\\192.168.56.101\sh_path

Within host OS, I cannot access the shared path in above. How to resolve it?


Avatar of rindi
rindi
Flag of Switzerland image

What HyperVisor are you using, what OS is your Host running?
Avatar of Peter Chan

ASKER

Host OS is Win 2019 server. VM is making use of Virtualbox.
First make sure you have installed the VirtualBox Guest Additions within Ubuntu. Then, in the VirtualBox Settings Menu of your VM, select "Shared Folders, Shared Folders Settings".

User generated image
User generated imageThen add your share something like in my Screenshot. After that you can access the shared folder of your Host within your VM by navigating to the Mount Point you created. I don't think it works from Guest to host, but rather only from Host to Guest. It is also possible that the options are a bit different in your case, as I'm running VirtualBox on a Linux Host, rather than on a Windoze host...
Yes, I shared path of Windows host to the VM but I cannot find out that shared path within Ubuntu guest VM.
It would be the Mount Point you selected when you setup the share. But you may need to first create the directory there. I have done that out of routine, I don't know if it would be created automatically.
The one highlighted below is the Windows host. Can I share one path of Windows host to the guest VM?
User generated image
Here is the shared path from Windows host
User generated image
but I cannot find it out below, within the guest, while I've run Virtualbox addition properly.
User generated image
Usually, the shared path is a resource on the host that is shared with the VM.

Seems unnecessary to access a local resource of the host via a path on the guest os.

You could share as many paths as you add to the VM.
After you added, did you reboot the vm?

Look df -k
Sh_path on Ubuntu

Place a file on the host side, see if it is there, then create a file on the Ubuntu side, and confirm you can see it on the host.
I think you are looking at the whole thing wrong. VirtualBox Shared Folders aren't to be compared with network shares. It is more of a service provided by VirtualBox that can be used via the Guest additions. They shouldn't be accessible via "Networks", but rather they get automatically mounted to the Mount Point you defined when the shared folder was setup. So once the VM is booted, the shared folder is already accessible directly at that Mount Point you defined earlier. All you have to do is navigate to it. No Network or Computername etc is involved. It looks just as if it is your Local File-System.
Arnold,
Using "df -k", I do not see the shared path of the host. 
In the image you posted earlier, there was a reference to the Windows server.
In the second, you have the sh_path on Ubuntu.
What is there?
sh_path is within Ubuntu guest. Now the issue is that I expect to access host's shared path, within the guest.
That is how it works, the host shares its storage resource with the guest which appears locally on the guest.

Though I think it should have been listed as a mounted resource in the listing..
Where to find it out and ensure that host's shared one is available there?

The one below is the host (Win 2019) but nothing is under it.

User generated image
Potentially, it should be at the root /sh_path
It is not.
User generated image
The root of the file system is /
You are posting the root user's home directory which is /root
The file explorer also does not look the same as your earlier post.

Can you confirm the host shared resource is connected?
Hi,
Current root is from "/" and the host's shared path is set up well to the VM.
User generated image
Loo at the left pane of the file explorer. In your earlier versions you had sh_path listed there in addition to vbox_guest

If properly shared, on a Windows system it is seen as a resource under computer, in Linux it should be reflected as a mount point listed in df -k

It is not supposed to be this hard to locate.
I cannot locate that host's shared path by "df -k".

If there is one shared path like

\\my.own.ip.addr\sh_path

how to access it within Ubuntu?


As I mentioned earlier, I usually create the folders I want to mount in the /mnt Folder, so for example it would look like this:

/mnt/sh_host

Then in the VirtualBox Settings for the VM I define the mount point to be /mnt/sh_host

Then when Ubuntu is started you can navigate to /mnt/sh_host & it is there. There is no IP involved.

Hi,
Now issue is that I cannot locate that shared path of host, within Ubuntu guest, while Virtualbox addition is fine. Where is the problem?
You haven't created the folder you want to mount to within Ubuntu yet is my guess. The Mount Point has to be created and exist in the Guest before the "share" can be mounted to it.
Host's path is well shared to guest VM. How to ensure that path is mounted inside Ubuntu VM?
First create the Folder you want to mount the shared path on within your VM, as in my example above. Open /mnt, then create a new folder, for example sh_path1. Then Shut down the VM. Now open the VM's settings, open Shared Folders in the Menu & edit the share you created earlier (as in my first screenshot). There make sure that what is in the "Mount Point:" box, is the same as the mountpoint you just created in the VM, in my example it would be /mnt/sh_path1.

Make sure "Automount" & "Make Permanent" are both on. Save then start the VM. Now in Ubuntu use the file manager to navigate to /mnt/sh_path1 & you will see the contents of the folder you shared of your host.
I followed up the steps of you and have done all of them in above. But after that, when I created other folder within "/mnt/sh_path2", I cannot see that within the path (same name) inside the host.
The folder you shared on the host probably hasn't got the right credentials for Ubuntu to write to. I don't know what rights are required on a Windoze FileSystem (I assume it is NTFS) for Linux users to be able to write to it, but probably the user "everyone" needs full control to the folder you have shared, or maybe the user "Guest" too.

I would also first put a file into that share using your Windoze host, & then see if you can see it in your VM.
Yes, there is other files originally existed within the shared path of the host, and I cannot see them within the path below

/mnt/sh_path2

inside the guest VM.
I'm not sure what is going wrong. As I mentioned, on my system I'm running VirtualBox on a Linux Host, & it works fine to a Linux Guest & Windoze Guest (although for Windoze Guests the setup is a little different). But I don't know how a Windoze Host must be setup for this to work properly.
Yes, I did do what you've suggested in the following. But it is not working expectedly within the guest VM.
User generated image

If there is one shared path like

\\my.own.ip.addr\sh_path

how to access it within Ubuntu?


ls -l /mnt/

You have to have the directory sh_path2 within there to function as the mount point.
cd /mnt
mkdir -p sh_path sh_path2

And rerun mount -a
Hi,
I do try to mount it but I cannot see contents of the shared path, within the host machine.
User generated image
Peter, I do not understand your image clearly reflects /mnt/sh_path2 that contains a backup image.

What are you looking to mount

The way a host share to the VM is handled is that once you edit the settings of the VM and specify that you want the VM to access a designated area of storage on the HOST, as you have, you identify the storage space d:\sh_path2 on the host to be accessible on the VM at /mnt/sh_path2

that is all it takes. Now the VM has /mnt/sh_path2 which provides the VM access to a shared space with the host.

You can place a file in /mnt/sh_path2 and then look on the host and the file will be accessible there.

This often can be used to provide a shared srotage space on the host to be accessed by several VMs.

What is your need?
Yes, within VM, I tried to copy files into "/mnt/sh_path2" and I also expect to copy files from the same path, in the host. But the files (I copied to such paths) are not available to the host machine. This is the problem.
When you copy files in, do you get an error?

The display in your example, shows a windows image backup folder.

is that what currently exists on the host in d:\sh_path2?

The confusing path, you have sh_path2 as the folder path and folder name.  Is one of the field automatically rendered?

My test would be to add file on the host and make sure it is seen in the VM to make sure I am dealing with the correct settings I am looking for.
Within host, I also copied files into d:\sh_path2 but I further cannot see the relevant files within the guest. I think there is problem to this.
On the Host, is it a directory you want to share (I'm afraid we can't see that in your image earlier, as the target you want to share is covered by the "Edit Share" box)? If I'm not mistaken, it has to be a directory. Then as I indicated earlier, you also have to setup the proper credentials on that directory so the users in your VM can even access it. Remember that Windoze probably doesn't know anything about your VM's user accounts, & vice versa. So you would need to allow access in your NTFS permissions (Not share Permissions) to allow access to unknown users (or add the user accounts within your VM to the host, if that is possible across the different OS's).
Thanks a lot.
I think it is also troublesome to resolve that NTFS issue with Windows host. Can we change the way like that I used scp below, to copy files (within VM guest) to one other remote shared path? How to resolve "time out" issue below?

User generated image
Then you wouldn't use VBox's sharing function, but rather setup a Share on the Windoze Server as you would other shares, then use a SAMBA Client within Ubuntu to connect to the share. But I doubt this would work in a "Host-Only" LAN setup. You'd rather need a "Bridge" as LAN.
Shared path does not only work with "Host-only" adapter, right?

Can you help to scp issue in above, as we've changed the way of this? 
SOLUTION
Avatar of rindi
rindi
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I shared one USB device to the VM. Would rebooting VM resolve problem below?
User generated image
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I cannot mount that USB device within Ubuntu VM. There is no process in host, that is using or holding anything of such USB device. What to further validate regarding this?
There must still be something with the Host preventing this. The problem is I don't use Windoze Server OS's so I don't know how they are working or setup. I only work from Linux hosts & have Linux & Windoze Guests. Both VBox's Shared Folders & USB redirection work for both Windoze & Linux Guests, I just had to make sure the user I'm running VBox from on my host is a member of the "vboxusers" group. Maybe there is a similar group you have to be member of on Windoze hosts for this to work.
I don't think so. If Host only works the way I believe it does, then you don't have any LAN Connection between host & VM, & SCP needs networking to work between the two. It's just the same as with Windoze Shares (SAMBA).