Exchanging files between virtual machine and host

Hi folks,

Just created a virtual machine using the XEN virtualization software (using vminstall) in order to have a script tested.

Unfortunately I haven’t figured out how to transfer files between the host and the virtual machine. How can I make the 2 file systems communicate locally without using any (external) internet connection? It would be rather inefficient to use Dropbox for example.

I would appreciate any ideas that could help me solve this issue.

Thanks in advance for your support!

Regards,
Liviu

What are the OS’s involved? If Linux, you can use SSH (Secure CoPy, so
SCP) out of the box assuming you have enabled SSH on the side you want to
be the server (both sides if you want to have either side be the server on
a case-by-case basis). The nice thing there is that if our clients side
is Linux there are built-in graphical ways to access the server
(Konqueror, Firefox I think, etc.) or command line options.

If the file server (in a client/server model) is ever windows, setting up
Samba for SMB-based transfers works well enough.


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

On 2014-04-13 21:06, Liviu82 wrote:

> Unfortunately I haven’t figured out how to transfer files between the
> host and the virtual machine. How can I make the 2 file systems
> communicate locally without using any (external) internet connection? It
> would be rather inefficient to use Dropbox for example.

Why external? Why not internal?

You communicate between host and guest same as you would connect any two
machines inside your lab, office, or home. You can share directories
using NFS or Samba (the Windows way), or using an FTP server, or an HTTP
server, or via SSH.

Whatever you prefer.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

The universal implementation in practically all virtualization technologies is to implement the Plan 9 protocol.

Interesting that I can’t Google a set of instructions how to setup in Xen.
Maybe you (or someone else) can find something, I’d be <very> surprised if Xen doesn’t support creating a mount point specifying the Plan 9 protocol from within the Guest. But, to do so also requires the ability to expose the shared directory first on the Host, and although similar the exact command to do so varies a little bit from one virtualization technology to another.

I wouldn’t be surprised at all if you tried the instructions to setup a Shared Folder using the SDB KVM instructions, <maybe> it might work in Xen, too.

My Google hits do suggest that Plan 9 protocol support was added in 2008, but I don’t see anything after that.
Maybe you’ll have better luck searching.

HTH,
TSU

I forgot I had posted this awhile back
http://en.opensuse.org/User:Tsu2/virtfs#Overview

If you install the libvirt packages, IMO should work for XEN the same way it works in KVM or any other virtualization technology.

Asking you to post back here if it really does work for you.

TSU

BTW -
As an alternative, although I don’t think it’s what you’re asking for but within the parameters of your original post,

You can set up a Host Only network and implement ordinary network connections and network shares. Because you’d be doing this on a Host Only network, the packets are never seen on the real physical network.

TSU

Thank you folks for your answers. Indeed I forgot to mention that the guest OS is Opensuse 13.1 (same as host) as I need to get a script tested before it will be run on the host (otherwise it would get messy on the host OS).

I will update you regarding the “result”.

Have a great day further!

Tried this, however it doesn’t work for XEN. It says it is not supported for this hypervisor/libvirt combination (referring to XEN).

I see 9p support may be in a “discussion” phase…
http://wiki.xen.org/wiki/GSoc_2014#Enabling_the_9P_File_System_transport_as_a_paravirt_device

I guess Xen is the libvirt outlier, possibly because unlike the other virtualization technologies which simply modify extensions to the kernel, Xen is its own kernel with a modified kernel base (AFAIK).

So, I guess you’re left with the other options I desceibed (unless someone who is a frequent Xen user might suggest otherwise).

Recommend setting up a virtual network that’s not a part of your main network if you want to keep the network bits off the wire… and on this Host Only network, configure ordinary network shares.

TSU

Found the solution to the issue. I installed VirtualBox and created a virtual machine which I connected to the host using the host-only network. Then I made the setup of ssh as follows:

  • host as server (sshd configured using sshd_config)
  • VM as guest (created a config file in the .ssh folder located in the home directory of the user)

Both SSH and SCP work just fine.

In addition to this I am very satisfied of how VBOX displays the output (it is perfectly scaled as if I worked directly with a physical machine). Sometimes I confuse the output of the VM with the output of the host :slight_smile:

So as a conclusion: problem solved!

If anyone is interested in more details I can gladly help.

Hi, this may not apply/be useful for your particular situation and also I have to confess to not having used VirtualBox on a Linux host, but I believe VirtualBox should have a very good working sharing mechanism that works through a share defined on the host.

For example, having a folder on host assigned in VirtualBox as a share named “vmshare” allows you to mount the share on /mnt/vmshare in a guest as

mount -t vboxsf vmshare /mnt/vmshare

the prerequisite being that you need to have VBoxExtensions installed in the guest.

There’s a How To on this here HOWTO: Use Shared Folders - virtualbox.org. Thanks.