I used libguestfs for transferring files from host OS to guest VM. It worked successfully. But since the tool being very huge and has many more functionalities, which my project doesn't need. I just want to use the functionality provided by virt-copy-in. Can you please tell where will I get the code which virt-copy-in uses internally? I have libguestfs folder. In that which files are used for the same functionality? Or else if u have code for the same, please do provide it. Regards, Priyanka Naik. On Wed, Dec 31, 2014 at 5:31 PM, Richard W.M. Jones <rjones@redhat.com> wrote:> On Tue, Dec 30, 2014 at 01:58:20PM +0530, Priyanka Naik wrote: > > I want to transfer files between host and guest. What are the ways to > > transfer these files? Is libguestfs the only way to transfer files > between > > host and guest? > > The question is under-specified. If you provide details of your > requirements, we can answer better. > > - What host? > - What guest? > - Which direction? > - Is the guest running? > - Continuous sharing or one-off transfer? > > If the guest is running, then the problem is how do you transfer files > between networked machines, and the usual solutions apply, eg. scp, > NFS, SMB, ... > > ONLY if the guest is NOT running, then you can use libguestfs to copy > files into the guest, eg. virt-copy-in. > > libguestfs can be used to extract files even from running guests, but > if the guest is running you MUST only use read-only commands. > > Rich. > > > -- > Richard Jones, Virtualization Group, Red Hat > http://people.redhat.com/~rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > virt-p2v converts physical machines to virtual machines. Boot with a > live CD or over the network (PXE) and turn machines into KVM guests. > http://libguestfs.org/virt-v2v >
And yes the guest is running. We are creating folder of files and want to transfer all files present in that folder. We have host OS as ubuntu and want to transfer files in one particular folder to guest VM which also has ubuntu as guest OS. On Mon, Jan 12, 2015 at 7:54 PM, Priyanka Naik <prnk.nk1@gmail.com> wrote:> I used libguestfs for transferring files from host OS to guest VM. It > worked successfully. But since the tool being very huge and has many more > functionalities, which my project doesn't need. I just want to use the > functionality provided by virt-copy-in. Can you please tell where will I > get the code which virt-copy-in uses internally? I have libguestfs folder. > In that which files are used for the same functionality? Or else if u have > code for the same, please do provide it. > > Regards, > Priyanka Naik. > > On Wed, Dec 31, 2014 at 5:31 PM, Richard W.M. Jones <rjones@redhat.com> > wrote: > >> On Tue, Dec 30, 2014 at 01:58:20PM +0530, Priyanka Naik wrote: >> > I want to transfer files between host and guest. What are the ways to >> > transfer these files? Is libguestfs the only way to transfer files >> between >> > host and guest? >> >> The question is under-specified. If you provide details of your >> requirements, we can answer better. >> >> - What host? >> - What guest? >> - Which direction? >> - Is the guest running? >> - Continuous sharing or one-off transfer? >> >> If the guest is running, then the problem is how do you transfer files >> between networked machines, and the usual solutions apply, eg. scp, >> NFS, SMB, ... >> >> ONLY if the guest is NOT running, then you can use libguestfs to copy >> files into the guest, eg. virt-copy-in. >> >> libguestfs can be used to extract files even from running guests, but >> if the guest is running you MUST only use read-only commands. >> >> Rich. >> >> >> -- >> Richard Jones, Virtualization Group, Red Hat >> http://people.redhat.com/~rjones >> Read my programming and virtualization blog: http://rwmj.wordpress.com >> virt-p2v converts physical machines to virtual machines. Boot with a >> live CD or over the network (PXE) and turn machines into KVM guests. >> http://libguestfs.org/virt-v2v >> > >
On Mon, Jan 12, 2015 at 07:58:40PM +0530, Priyanka Naik wrote:> And yes the guest is running. We are creating folder of files and want to > transfer all files present in that folder. We have host OS as ubuntu and > want to transfer files in one particular folder to guest VM which also has > ubuntu as guest OS.virt-copy-in is *unsafe* to use on running guests, and will certainly result in permanent unrecoverable disk corruption. Do not use it this way. I strongly advise that you look at normal network transfer methods, such as NFS, rsync and so on. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/