Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mount host machine folder #45

Open
mafintosh opened this issue Aug 1, 2015 · 10 comments
Open

mount host machine folder #45

mafintosh opened this issue Aug 1, 2015 · 10 comments

Comments

@mafintosh
Copy link

hey! great project!
is there anyway to mount a folder from the host machine inside the vm?

@colby-swandale
Copy link

you could use a nfs mount.

@gregory
Copy link

gregory commented Aug 4, 2015

could you give more details @colby-swandale

@colby-swandale
Copy link

@gregory
Copy link

gregory commented Aug 5, 2015

oh sorry. i thought you meant a clean way to do it.... dont want to setup nfs server just for that :(
i used nfs at the very beginning when guest addition was not in boot2docker yet. thx though

@huytd
Copy link

huytd commented Aug 15, 2015

yes, I'm looking for something like shared folder in VirtualBox with xhyve :D is there any way to do that?

@huytd
Copy link

huytd commented Aug 15, 2015

OK, Thank to @colby-swandale
Running NFS server is not a big deal, it's very simple with just 1 command line.
Here is the detailed note on how to mount host machine folder:

Host: Mac OS X
Client: TinyCore

Step 1: Enable network in xhyverun

If you are using xhyverun.sh to boot the TinyCore, just delete the comment character (#) before NET config

# NET="-s 2:0,virtio-net"

to

NET="-s 2:0,virtio-net"

Start the TinyCore VM with sudo:

sudo ./xhyverun.sh

Step 2: Setup NFS Server on Host

  • Create /etc/exports file
sudo touch /etc/exports
sudo vi /etc/exports
  • Config the Exports file with the following syntax:
/Folder/on/host -mapall=501

Each folder in a line. The mapall parameter indicate the ID of user that have permission to access that host folder.
To find your user ID, type:

id

This is important unless you want to get Connection refused error when mounting from client.

For example, this is my /etc/exports file:

/Users/huy/Shared -mapall=501

Step 3: Start and check NFS Server

  • Start the NFS server with the following command:
sudo nfsd start

or restart it if it already started.

sudo nfsd restart
  • Check the shared folder with the following command:
showmount -e

Your shared folder should displayed.

Step 4: Mount the host folder on guest machine

In TinyCore guest, create a folder somewhere to access the shared folder, for example:

mkdir ~/shared

Mount the host folder with the following command:

sudo mount -o nolock <host-ip>:/Users/huy/Shared/ ~/shared

Done!

@xez
Copy link
Contributor

xez commented Aug 18, 2015

It would be cool if bhyve/xhyve had an implementation of VirtFS/virtio-9p as a much more efficient way to support shared folders. u9fs might be a good starting point for a VirtIO implementation and seems to be license compatible.

@stv0g
Copy link

stv0g commented Mar 31, 2016

There's a fork which implements virtio-9p here: https://github.com/jceel/xhyve

UPDATE: Also have a look at #70. I successfully rebased it against the latest version and I am pretty happy with it stv0g/xyhve@virtio-9p

@mauron85
Copy link

Probably no news for most of you, but you could use https://syncthing.net/. Using it with alpine linux and OSX. Very easy to setup if you don't mind syncing is not instant thing.

@xpepermint
Copy link

Status?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants