Can I use virt-filesystem on a running VM?
Well, if I've run from kvm hypervisor this command with a live guest: virt-filesystems --long -h --all -a /home/storage-plus/myvm.qcow2 It outputs: `libguestfs: error: list_filesystems: parted exited with status 1: Error: Can't have a partition outside the disk!` But the very very sad of the story is that guest filesystem crashes: ene 05 21:23:22 myvm.example.com kernel: blk_update_request: I/O error, dev vda, sector 25652400 ene 05 21:23:22 myvm.example.com kernel: XFS (dm-0): writeback error on sector 20430000 ene 05 21:23:22 myvm.example.com kernel: blk_update_request: I/O error, dev vda, sector 25651200 ene 05 21:23:22 myvm.example.com kernel: XFS (dm-0): writeback error on sector 20428800 ene 05 21:23:27 myvm.example.com kernel: blk_update_request: I/O error, dev vda, sector 44519951 ene 05 21:23:27 myvm.example.com kernel: blk_update_request: I/O error, dev vda, sector 44519951 ene 05 21:23:27 myvm.example.com kernel: blk_update_request: I/O error, dev vda, sector 5222401 ene 05 21:23:27 myvm.example.com kernel: blk_update_request: I/O error, dev vda, sector 5231568 ene 05 21:23:27 myvm.example.com kernel: blk_update_request: I/O error, dev vda, sector 5232232 ene 05 21:23:27 myvm.example.com kernel: blk_update_request: I/O error, dev vda, sector 5237584 ene 05 21:23:27 myvm.example.com kernel: blk_update_request: I/O error, dev vda, sector 5262240 ene 05 21:23:27 myvm.example.com kernel: blk_update_request: I/O error, dev vda, sector 5379440 ene 05 21:23:27 myvm.example.com kernel: XFS (dm-0): metadata I/O error in "xlog_iodone" at daddr 0x257a20f len 64 error 5 ene 05 21:23:27 myvm.example.com kernel: XFS (dm-0): xfs_do_force_shutdown(0x2) called from line 1238 of file fs/xfs/xfs_log.c. Return address = ffffffffc028a840 ene 05 21:23:27 myvm.example.com kernel: XFS (dm-0): Log I/O Error Detected. Shutting down filesystem ene 05 21:23:27 myvm.example.com kernel: XFS (dm-0): Please umount the filesystem and rectify the problem(s) ene 05 21:23:27 myvm.example.com kernel: XFS (dm-0): xfs_imap_to_bp: xfs_trans_read_buf() returned error -5. ene 05 21:23:27 myvm.example.com kernel: XFS (dm-0): xfs_iunlink_remove: xfs_imap_to_bp returned error -5. ene 05 21:23:27 myvm.example.com auditd[633]: Audit daemon is suspending logging due to previously mentioned write error ene 05 21:23:27 myvm.example.com systemd[1]: rsyslog.service: main process exited, code=killed, status=7/BUS ene 05 21:23:27 myvm.example.com systemd[1]: Unit rsyslog.service entered failed state. ene 05 21:23:27 myvm.example.com systemd[1]: rsyslog.service failed. ene 05 21:23:27 myvm.example.com systemd[1]: rsyslog.service holdoff time over, scheduling restart So did I miss something? Or is it a bug? Software versions are: Guest OS: CentOS Linux release 7.8.2003 (Core) Hypervisor OS: CentOS Linux release 7.5.1804 (Core) with: - qemu-kvm-1.5.3-175.el7_9.1.x86_64 - libguestfs-tools-c-1.40.2-10.el7.x86_64 Thanks in advance! -- -- Sergio Belkin LPIC-2 Certified - http://www.lpi.org
On Thu, Jan 07, 2021 at 06:12:52PM -0300, Sergio Belkin wrote:
Well, if I've run from kvm hypervisor this command with a live guest: virt-filesystems --long -h --all -a /home/storage-plus/myvm.qcow2
Yes and no! https://libguestfs.org/guestfs-faq.1.html#can-i-monitor-the-live-disk-activi... 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/
El vie, 8 ene 2021 a las 16:12, Richard W.M. Jones (<rjones@redhat.com>) escribió:
On Thu, Jan 07, 2021 at 06:12:52PM -0300, Sergio Belkin wrote:
Well, if I've run from kvm hypervisor this command with a live guest:
virt-filesystems --long -h --all -a /home/storage-plus/myvm.qcow2
Yes and no!
https://libguestfs.org/guestfs-faq.1.html#can-i-monitor-the-live-disk-activi...
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/
Thans Rich for your answer, it enlightened me :) But I still have the question (perhaps my subject was not clear enough), can the tool virt-filesystems cause that guest filesystem crashes? Thanks again! -- -- Sergio Belkin LPIC-2 Certified - http://www.lpi.org
On Fri, Jan 08, 2021 at 05:13:36PM -0300, Sergio Belkin wrote:
But I still have the question (perhaps my subject was not clear enough), can the tool virt-filesystems cause that guest filesystem crashes?
Oh wait, so the error happened in the guest? That's pretty bad. virt-filesystems will place an overlay over the original disk image to protect it. We also have a regression test to ensure that nothing writes to the original disk in this situation: https://github.com/libguestfs/libguestfs/tree/master/tests/qemu However it may have been that something (SELinux? libvirtd?) saw this action and stopped the original guest from accessing its own disk. If you have time you might see if there are any SELinux or libvirt log messages associated with this. Or if the guest qemu wrote anything to its log file (/var/log/libvirt/qemu/guestname.log). Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
I think I know what the problem is here actually. When we run libguestfs with the libvirt backend[1], libvirt will try to relabel the disks that we're trying to access. In the process it may relabel them in a way that makes them inaccessible to the original guest. There are a couple of ways to avoid this. The simpler one is to avoid using the libvirt backend altogether: export LIBGUESTFS_BACKEND=direct The other one is to use the '-d' option (instead of '-a') which should cause libguestfs to copy the SELinux label to libvirt and (if everything goes well) will cause libvirt to use the correct label. Rich. [1] https://libguestfs.org/guestfs.3.html#backend -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Here's the code that copies that label: https://github.com/libguestfs/libguestfs/blob/de9a5e59f14a0fee1387d516f5abd4... 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
participants (2)
-
Richard W.M. Jones -
Sergio Belkin