Web lists-archives.com

Re: Access a sub partition from KVM host




On 01/05/18 01:22, Richard Hector wrote:
On 01/05/18 04:31, André Rodier wrote:
Hello Debian experts,

I have a kvm/libvirt installed on Debian, with a Windows 10 virtual
machine.
The Windows virtual machine has access the a whole disk partition,
/dev/sda2, that I have added using the virtual machine manager.
Because Windows "see" this partition as a disk, it has created
partitions inside.

When I use kpartx, I see the partitions:

root@main:/etc# kpartx /dev/sda2
sda2p1 : 0 262144 /dev/sda2 34
sda2p2 : 0 4469876736 /dev/sda2 264192

However, kpartx does not create the device files in /dev

I need to mount this partition from Linux, as *read only*, to share the
files easily between Linux and Windows.

Can I mount these partitions from Linux easily, or should I use loop
device?

kpartx can do that, with -a ...

But I would seriously not do that, unless the Windows VM isn't running.
Even read only.

Neither OS will know what the other one is doing, and could be keeping
caches or whatever ... you're liable to get corruption.

I would suggest sharing the directories over the network instead. A
little slower, but much safer.

Richard


Thanks, Richard I will probably end up doing this.

--
André Rodier.
https://github.com/progmaticltd/homebox