Skip to contentSkip to conversation

nbd-server / monitor to copy files/directory in to running VM.

Qemu-devel Jd 4 participants 4 messages Oct 28, 2014 – Oct 29, 2014

lore
Share & tools
lore

Jd

author
#0 lore raw

Hi
I see an option to start nbd-server from running VM via qemu monitor.
This is very useful. The option seems to allow sharing the disk with read/write permission. Can I really export and use the nbd-served disk from running vm in read/write ? Isnt there a risk for corrupting the file system ?

qemu monitor seems to have command to open, write, close commands. I
tried them and I could create a file (after going through encoding). How can I create a directory using this ?

I read little bit about live-guestfs, but it needs another agent in
to the VM. Also, is this ready for prime time ? Any plans to have this in the qemu guest agent. This way we dont have to have multiple agents required in the guest.

Is there any other ideas on copying files in to a running VM ?

Thanks
/Jd

#1 lore raw
Quoted 6 lines · Jd

Hi
I see an option to start nbd-server from running VM via qemu monitor.
This is very useful. The option seems to allow sharing the disk with read/write permission. Can I really export and use the nbd-served disk from running vm in read/write ? Isnt there a risk for corrupting the file system ?

You must know what you are doing. In general the answer is yes, you risk corrupting the file system.

Paolo

Quoted 15 lines

qemu monitor seems to have command to open, write, close commands. I
tried them and I could create a file (after going through encoding). How can I create a directory using this ?

I read little bit about live-guestfs, but it needs another agent in to
the VM. Also, is this ready for prime time ? Any plans to have this in the qemu guest agent. This way we dont have to have multiple agents required in the guest.

Is there any other ideas on copying files in to a running VM ?

Thanks
/Jd

#2 lore raw
In reply to Jd
Quoted 3 lines · Jd

qemu monitor seems to have command to open, write, close commands. I tried
them and I could create a file (after going through encoding). How can I create a directory using this ?

Do you mean the code in qga/? That is the QEMU guest agent. It does not have a command to create directories.

Quoted 4 lines

I read little bit about live-guestfs, but it needs another agent in to the
VM. Also, is this ready for prime time ? Any plans to have this in the qemu guest agent. This way we dont have to have multiple agents required in the guest.

live-guestfs? Never heard of it.

Do you mean libguestfs? That's a tool for disk image manipulation. Very powerful but works on offline guest disk images. It does not work while the guest is running.

Quoted 1 line

Is there any other ideas on copying files in to a running VM ?

The same network transports that you would use on a physical machine:
HTTP, CIFS, NFS.

Or an emulated device like a USB Mass Storage Device (like hot-plugging a thumbdrive into a computer) or the experimental USB Media Transfer Protocol emulation.

Stefan

#3 lore raw
Quoted 13 lines · Stefan Hajnoczi
Quoted 3 lines · Jd

qemu monitor seems to have command to open, write, close commands. I tried
them and I could create a file (after going through encoding). How can I create a directory using this ?

Do you mean the code in qga/? That is the QEMU guest agent. It does not have a command to create directories.

Quoted 4 lines

I read little bit about live-guestfs, but it needs another agent in to the
VM. Also, is this ready for prime time ? Any plans to have this in the qemu guest agent. This way we dont have to have multiple agents required in the guest.

Quoted 5 lines

live-guestfs? Never heard of it.

Do you mean libguestfs? That's a tool for disk image manipulation. Very powerful but works on offline guest disk images. It does not work while the guest is running.

Regular libguestsfs will run against an live guest, but it restricts itself to readonly mode in that case since you can't modify disks behind the back of the guest OS, or QEMU itself.

libguestfs does have a mode where it *can* run against a live guest. You need to install the libguestfs daemon in the guest and setup a virtio-serial channel in your guest so it can safely access the guest that way:

http://rwmj.wordpress.com/2011/07/06/libguestfs-live/

The QEMU NBD server won't be much help with this though. The NBD server in QEMU is still running behind the back of the guest OS, so it must only export the disks in read-only mode. If the QEMU NDB server were to export in read-write mode, any writes would corrupt the disks from the POV of the guest OS. Also the libguestfs daemon always *wants* to be inside a guest, because it relies on Linux kernel to access the various filesystems. So even in read-only mode QMEU NBD server doesn't really do anything immediately useful for libguestfs vs current state of its code.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|