Read-only iscsi disk? Or hot-plug?

Paul van der Vlis paul at vandervlis.nl
Mon Sep 7 20:24:20 UTC 2020


Op 07-09-2020 om 10:35 schreef Peter Krempa:
> On Mon, Sep 07, 2020 at 10:07:29 +0200, Paul van der Vlis wrote:
>> Hello,
>>
>> I have an iSCSI disk with a backup. I want to use that backup on another
>> machine to test putting back data.
>>
>> What I use now is this:
>> ----
>>     <disk type='block' device='disk'>
>>       <driver name='qemu' type='raw' cache='directsync' io='native'/>
>>       <source dev='/dev/disk/by-id/scsi-36e843b6afdddf65dc4e9d4dc2dab66de'/>
>>       <target dev='vdh' bus='virtio'/>
>>       <address type='pci' domain='0x0000' bus='0x00' slot='0x0c'
>> function='0x0'/>
>>     </disk>
>> ----
>>
>> Is it possible to do this read-only?
> 
> Yes, you can add a <readonly/> element under disk to make it read only.
> 
> You'll also need to use <shareable/> on the VM where it's read-write so
> that both VMs can access it.

Thanks, this did work!

With regards,
Paul


> Note that, if the VM in read-mode is actively writing to the device, the
> read-only VM may not know about that and may have the data changed while
> reading.
> 
>> What I also could do is to hot-unplug the disk at the production
>> machine, and then hot-plug it at the test-machine. But the machines are
>> Windows, and I don't know Windows well.
> 
> Windows should support unplug of the virtio device, so this should work
> as well.
> 
> 


-- 
Paul van der Vlis Linux systeembeheer Groningen
https://www.vandervlis.nl/




More information about the libvirt-users mailing list