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