[Libguestfs] Can I use virt-filesystem on a running VM?

Richard W.M. Jones rjones at redhat.com
Mon Jan 11 15:30:13 UTC 2021


On Mon, Jan 11, 2021 at 12:04:22PM -0300, Sergio Belkin wrote:
> 
> 
> El lun, 11 ene 2021 a las 6:41, Richard W.M. Jones (<rjones at redhat.com>)
> escribió:
> 
>     On Sat, Jan 09, 2021 at 05:23:13PM -0300, Sergio Belkin wrote:
>     > So do you think that is a SELinux issue (I haven't found anything
>     > related to this with ausearch or audit logs)? So, can
>     > virt-filesystems crash the guest? (I had to reboot and repair the
>     > xfs)
> 
>     It's not that virt-filesystems is affecting the guest, it's that
>     libvirtd relabels the disks and as a result original qemu loses access
>     to its disks.
> 
>     Try with LIBGUESTFS_BACKEND=direct which doesn't use libvirt or
>     SELinux labelling.
> 
>     Rich.
> 
>     --
>     Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/
>     ~rjones
>     Read my programming and virtualization blog: http://rwmj.wordpress.com
>     libguestfs lets you edit virtual machines.  Supports shell scripting,
>     bindings from many languages.  http://libguestfs.org
> 
> 
> 
> Hi Richard, thanks for your kind explanation and help. It worked like a charm.
> 
> In case it becomes useful to someone, I get:
> 
> Name                    Type       VFS  Label MBR Size Parent             UUID
> /dev/sda1               filesystem xfs  -     -   500M -                
>  8746b377-7e21-4cb5-b269-c034720d65c1
> /dev/centos_lx0001/root filesystem xfs  -     -   48G  -                
>  3a3d6041-5f1c-479f-92cf-42a569d57bab
> /dev/centos_lx0001/swap filesystem swap -     -   2,0G -                
>  76addd8c-7aa1-4779-8a86-70ab6baca2b2
> /dev/centos_lx0001/root lv         -    -     -   48G  /dev/centos_lx0001
> 2d4fOO-fXZm-HDHi-CiTY-umH3-Icu9-peXjGZ
> /dev/centos_lx0001/swap lv         -    -     -   2,0G /dev/centos_lx0001
> mbKcjk-YXVg-MjhS-L0IA-cNgg-KF0o-4uxvc5
> /dev/centos_lx0001      vg         -    -     -   50G  /dev/sda2        
>  17HB8hKfxKZHis9Tcrq2XoFLldN0fAft
> /dev/sda2               pv         -    -     -   50G  -                
>  NZT8FHFBUed0PZyKsrXLWAnemghOO0J7
> /dev/sda1               partition  -    -     83  500M /dev/sda           -
> /dev/sda2               partition  -    -     8e  50G  /dev/sda           -
> /dev/sda                device     -    -     -   50G  -                  -
> 
> Jut only a question about this output, just out of curiosity why does it print
> /dev/sda* instead /dev/vda* ?

We don't know what drivers are installed in the guest, or (in
virt-filesystems) even what the guest is.  Maybe it's Linux with
virtio.  Maybe it's Windows.  So we use a canonical naming scheme for
devices and partitions:

https://libguestfs.org/guestfs.3.html#block-device-naming

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list