Many thanks.



------------------ Original ------------------
From: &nbsp;"Richard W.M. Jones";<[email protected]&gt;;
Send time:&nbsp;Friday, Mar 19, 2021 6:58 PM
To:&nbsp;"??????"<[email protected]&gt;; 
Cc:&nbsp;"libguestfs"<[email protected]&gt;; 
Subject: &nbsp;Re: [Libguestfs] error invalid partition data while using 
libguestfs-tools



On Fri, Mar 19, 2021 at 11:47:09AM +0800, ?????? wrote:
&gt; Thanks for replying, rich.
&gt; 
&gt; here are some informations i gathered. the guest is linux (centos) and i 
find
&gt; out the guest's file system is 'xfs' using `df -hT`:
&gt; 
&gt; ```
&gt; $ df -hT
&gt; 
Filesystem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Size&nbsp; Used Avail Use% Mounted on
&gt; /dev/mapper/centos-root xfs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8.0G&nbsp; 
1003M&nbsp; 7.1G&nbsp;&nbsp; 13% /
&gt; 
devtmpfs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 devtmpfs&nbsp; 484M&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; 484M&nbsp;&nbsp;&nbsp; 0% 
/dev
&gt; 
tmpfs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 tmpfs&nbsp;&nbsp;&nbsp;&nbsp; 496M&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; 
496M&nbsp;&nbsp;&nbsp; 0% /dev/shm
&gt; 
tmpfs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 tmpfs&nbsp;&nbsp;&nbsp;&nbsp; 496M&nbsp; 6.8M&nbsp; 489M&nbsp;&nbsp;&nbsp; 2% 
/run
&gt; 
tmpfs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 tmpfs&nbsp;&nbsp;&nbsp;&nbsp; 496M&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; 
496M&nbsp;&nbsp;&nbsp; 0% /sys/fs/cgroup
&gt; 
/dev/vda1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 xfs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1014M&nbsp; 132M&nbsp; 883M&nbsp;&nbsp; 14% 
/boot
&gt; 
tmpfs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 tmpfs&nbsp;&nbsp;&nbsp;&nbsp; 100M&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; 
100M&nbsp;&nbsp;&nbsp; 0% /run/user/0
&gt; ```
&gt; 
&gt; and sgdisk version is 0.8.10:
&gt; 
&gt; ```
&gt; $ sgdisk --version
&gt; GPT fdisk (sgdisk) version 0.8.10
&gt; ```
&gt; 
&gt; also, i tried the command you gave. it came out the same output:
&gt; 
&gt; ```
&gt; $ virt-rescue --ro -d 138093b9b33345c38e58efa014036bd8
&gt; &gt;<rescue&gt; sgdisk /dev/sdb -i 1
&gt; Invalid partition data!
&gt; ```

Yup, basically sgdisk thinks the partition is invalid.&nbsp; Version 0.8.10
is really ancient - from 2014, so I'd start with a newer version.

Rich.

&gt; but strange things happened when i tried some other reports' suggestions:
&gt; 
&gt; https://listman.redhat.com/archives/libguestfs/2016-February/msg00145.html
&gt; https://listman.redhat.com/archives/libguestfs/2018-November/msg00026.html
&gt; 
&gt; i did these things:
&gt; 
&gt; 1. set LIBGUESTFS_BACKEND to direct;
&gt; 2. recompile the `libguestfs-1.40.2-10.el7.src.rpm` without the `
&gt; XXXX-RHEL-7-Reject-use-of-libguestfs-winsupport-features-.patch `;
&gt; 3. run the `virt-rescue` command again.
&gt; 
&gt; ```
&gt; $ virt-rescue --ro -d 138093b9b33345c38e58efa014036bd8
&gt; &gt;<rescue&gt; sgdisk /dev/sdb -i 1
&gt; Creating new GPT entries.
&gt; Partition #1 does not exist.
&gt; ```
&gt; 
&gt; and the command works somehow. apparently, i still dont understand what
&gt; happened indeed. and i have read about the official explanation of
&gt; LIBGUESTFS_BACKEND, is this something to do with libvirt? is it a bug or
&gt; something?
&gt; 
&gt; https://libguestfs.org/libguestfs-test-tool.1.html#
&gt; 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.&nbsp; Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
_______________________________________________
Libguestfs mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to