5

I have to make a configuration file available to guest OS running on top of KVM hyper-visor.

I have already read about folder sharing options between host and guest in KVM with 'qemu' and 9P virtio support. I would like to know about any simple procedure which can help in one time file transfer from host to guest.

Please let me know, how to transfer file while guest OS is running as well as a possible way to make the file available to guest OS by the time it starts running(like packaging the file and integrating with the disk-image if possible).

Host OS will be linux.

4

Just hit upon two different ways:

  • Transfer files via network. For example you can run httpd on the host and use any web browser or wget/curl to download files. Probably most easy and handy.
  • Build ISO image on the host with files you want to transfer. Then attach it to the guest's CD drive.

    genisoimage -o image.iso -r /path/to/dir
    virsh attach-disk guest image.iso hdc --driver file --type cdrom --mode readonly
    
    • You can use mkisofs instead of genisoimage.
    • You can use GUI like virt-manager instead of virsh CUI to attach an ISO image to the guest.
    • You need to create a VM beforehand, supply that VM's ID as guest. You can see existing VMs by virsh list --all.
  • Any standard network file transfer protocol should work, such as setting up an FTP or NFS server on the host. – bgvaughan Jun 2 '15 at 10:41
  • 1
    Consider using scp or rsync which are often already available on both host and guest. – Lambert Jun 2 '15 at 10:47
  • @bgvaughan I cannot access guest OS to run commands. I have to make those files available. So, I just cannot make host as a server to keep files in host and give access to guest. Thanks. – MVSR Jun 2 '15 at 10:47
  • 1
    @MVSR You need to create a VM beforehand, supply that VM's ID as guest. You can see existing VMs by virsh list --all. – yaegashi Jun 2 '15 at 10:52
  • @yaegashi Thanks. I ll look into it. I just figured it out and deleted the earlier comment. Please add the additional info in the answer and I will accept it. – MVSR Jun 2 '15 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.