[Libguestfs] Using nested partition with LUKS+GPT

Richard W.M. Jones rjones at redhat.com
Sat Apr 29 06:52:56 UTC 2023


On Fri, Apr 28, 2023 at 03:32:57PM +0200, Philippe Midol-Monnet wrote:
> Hi
> 
> I have already fulfill a an issue, but it looks like it's not the recommended
> process.
> 
> 
> We are using a LUKS partition containing a GPT table and several partions.
> 
> With libguestfs we can open the LUKS partition and the /dev/mapper/<mapname>
> device become available, but nested partition are not seen by the kernel.
> partprobe need to be run (or may be kpartx) to make partitions available in /
> dev/mapper.
> 
> AFAIK there are no simple solution.
> As a workaround we use guestfs_debug but it's not a long term solution.
> 
> We can see two solutions:
> 
>   • adding a udev rule that will automatically run partpobe when a new device
>     appeared in /dev/mapper
>   • adding a new API in libguestfs guestfs_partprobe(device) that can be call
>     by the user when needed.
> 
> What is the best best solution from your point of view?
> We can help implementing it.

I don't think there's any great answers here.  Could you do the
partition selection outside libguestfs?  If it was a plain (not LUKS)
partition then the answer would be yes, easily, with
nbdkit-partition-filter:

https://libguestfs.org/nbdkit.1.html#Combining-plugins-and-filters

nbdkit also supports LUKS, but only LUKS v1, not the more common v2.

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


More information about the Libguestfs mailing list