<meta http-equiv="Content-Type" content="text/html; charset=GB18030"><div>Many thanks.</div><div><div><br></div><div><br></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------ Original ------------------</div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>From: </b> "Richard W.M. Jones";<rjones@redhat.com>;</div><div><b>Send time:</b> Friday, Mar 19, 2021 6:58 PM</div><div><b>To:</b> "Ç®·Ç·²"<b3ale693592@foxmail.com>; <wbr></div><div><b>Cc:</b> "libguestfs"<libguestfs@redhat.com>; <wbr></div><div><b>Subject: </b> Re: [Libguestfs] error invalid partition data while using libguestfs-tools</div></div><div><br></div>On Fri, Mar 19, 2021 at 11:47:09AM +0800, Ç®·Ç·² wrote:<br>> Thanks for replying, rich.<br>> <br>> here are some informations i gathered. the guest is linux (centos) and i find<br>> out the guest's file system is 'xfs' using `df -hT`:<br>> <br>> ```<br>> $ df -hT<br>> Filesystem              Type      Size  Used Avail Use% Mounted on<br>> /dev/mapper/centos-root xfs       8.0G  1003M  7.1G   13% /<br>> devtmpfs                devtmpfs  484M     0  484M    0% /dev<br>> tmpfs                   tmpfs     496M     0  496M    0% /dev/shm<br>> tmpfs                   tmpfs     496M  6.8M  489M    2% /run<br>> tmpfs                   tmpfs     496M     0  496M    0% /sys/fs/cgroup<br>> /dev/vda1               xfs      1014M  132M  883M   14% /boot<br>> tmpfs                   tmpfs     100M     0  100M    0% /run/user/0<br>> ```<br>> <br>> and sgdisk version is 0.8.10:<br>> <br>> ```<br>> $ sgdisk --version<br>> GPT fdisk (sgdisk) version 0.8.10<br>> ```<br>> <br>> also, i tried the command you gave. it came out the same output:<br>> <br>> ```<br>> $ virt-rescue --ro -d 138093b9b33345c38e58efa014036bd8<br>> ><rescue> sgdisk /dev/sdb -i 1<br>> Invalid partition data!<br>> ```<br><br>Yup, basically sgdisk thinks the partition is invalid.  Version 0.8.10<br>is really ancient - from 2014, so I'd start with a newer version.<br><br>Rich.<br><br>> but strange things happened when i tried some other reports' suggestions:<br>> <br>> https://listman.redhat.com/archives/libguestfs/2016-February/msg00145.html<br>> https://listman.redhat.com/archives/libguestfs/2018-November/msg00026.html<br>> <br>> i did these things:<br>> <br>> 1. set LIBGUESTFS_BACKEND to direct;<br>> 2. recompile the `libguestfs-1.40.2-10.el7.src.rpm` without the `<br>> XXXX-RHEL-7-Reject-use-of-libguestfs-winsupport-features-.patch `;<br>> 3. run the `virt-rescue` command again.<br>> <br>> ```<br>> $ virt-rescue --ro -d 138093b9b33345c38e58efa014036bd8<br>> ><rescue> sgdisk /dev/sdb -i 1<br>> Creating new GPT entries.<br>> Partition #1 does not exist.<br>> ```<br>> <br>> and the command works somehow. apparently, i still dont understand what<br>> happened indeed. and i have read about the official explanation of<br>> LIBGUESTFS_BACKEND, is this something to do with libvirt? is it a bug or<br>> something?<br>> <br>> https://libguestfs.org/libguestfs-test-tool.1.html#<br>> trying-out-with-without-libvirt<br><br>It's unlikely that libguestfs or libvirt or the backend has anything<br>to do with this.<br><br>The partition is corrupt and/or ancient sgdisk has a bug.<br><br>Rich.<br><br>-- <br>Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones<br>Read my programming and virtualization blog: http://rwmj.wordpress.com<br>virt-p2v converts physical machines to virtual machines.  Boot with a<br>live CD or over the network (PXE) and turn machines into KVM guests.<br>http://libguestfs.org/virt-v2v<br><br></div>