libguestfs live

It has been possible for a while to use libguestfs to access a running guest by installing guestfsd in the guest.

Up until now the process required lots of manual configuration. However today (thanks to Dan and Lennart), the process is almost automatic.

You just have to install the new (Rawhide-only) libguestfs-live-service package inside the guest.

On the host, add the following clause to the guest’s XML:

<channel type='unix'>
  <source mode='bind' path='/var/lib/libvirt/qemu/$GUESTNAME.libguestfs' />
  <target type='virtio' name='org.libguestfs.channel.0' />
</channel>

(Replace $GUESTNAME with the name of the guest. We will likely change virt-install to make the above automatic.)

Update: librarian points out that you need qemu ≥ 0.14, and you also need to change the machine type to pc-0.14, otherwise virtio-serial sockets are not supported.

You can now connect using guestfish, eg:

# guestfish --live -d FedoraRawhidex64

Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.

Type: 'help' for help on commands
      'man' to read the manual
      'quit' to quit the shell

><fs> run
><fs> lvs
/dev/vg_fedorarawhidex64/lv_root
/dev/vg_fedorarawhidex64/lv_swap
><fs> touch /tmp/foo

A word of warning: Trying to edit disk images which are in use by virtual machines is dangerous and will result in disk corruption. libguestfs live works quite differently — it talks to the daemon running inside the guest and the daemon makes the changes safely.

About these ads

6 Comments

Filed under Uncategorized

6 responses to “libguestfs live

  1. feeliwood

    hi Mr. Rich, should we install libguestfs before we install libguestfs-live-service package.
    thanks.

  2. feeliwood

    hi Mr.Rich,
    I create and manage VMs with qemu, qemu-kvm command.
    I don`t use virt-manager or any libvirt`s tool.
    I`ve been searching the host file system but I can`t find any guest`s xml file.
    Should I use virt-manager ?
    Thank you

  3. feeliwood

    thank you

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s