Re: Is it possible to pass-through a SATA port (not a controller and not a drive, but a single port)?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20.12.2017 15:37, Paolo Bonzini wrote:

> Passing through a port is not possible, but it's possible to hot-unplug
> the entire virtio-blk disk and add it back, like:
> 
>    -drive if=none,id=bupdisk,file=/dev/sda,format=raw,cache=none
>    -device virtio-blk-pci,drive=bupdisk
> 
> and then, to change the drive:
> 
>    in the guest: sync
>    in the QEMU monitor: device_del bupdisk
>    on the host: echo 1 > /sys/block/sda/device/delete
>    in the QEMU monitor:
>       drive_add 0 if=none,id=bupdisk,file=/dev/sda,format=raw,cache=none
>       device_add virtio-blk-pci,drive=bupdisk
> 
> This uses PCI hotplug.  An alternative is to use virtio-scsi; then you
> can keep always the same controller and do the hotplug at the SCSI level:
> 
>    -device virtio-scsi-pci,id=scsi
>    -drive if=none,id=bupdisk,file=/dev/sda,format=raw,cache=none
>    -device scsi-hd,drive=bupdisk,bus=scsi.0
> 
> and then, to change the drive:
> 
>    in the guest: sync
>    in the QEMU monitor: device_del bupdisk
>    on the host: echo 1 > /sys/block/sda/device/delete
>    in the QEMU monitor:
>       drive_add 0 if=none,id=bupdisk,file=/dev/sda,format=raw,cache=none
>       device_add scsi-hd,drive=bupdisk,bus=scsi.0

At first, thank you very much for that invaluable answer. Of course, I
had studied the man page of qemu-system-x86_x64, but that sort of expert
knowledge isn't in there :-)

I will try both solutions you proposed. The problem I currently can see
is that the guest does not provide a sync command (not even Windows
server versions do so). Instead, if Windows has identified a removable
storage device, it shows a symbol in the tray which can be used to
"eject" (safely remove) that device.

Thus, at the first place (but see below), if your solution will work or
not depends on whether the guest treats the backup disk as removable
drive after I have changed the command line as advised. If it does not
see it as removable, the tray symbol will be missing and there will be
no way to eject the drive.

Furthermore, as far as I remember, Windows could possibly crash or
corrupt data if you would forcefully remove drives, even if a sync
command would have been issued before. At least, from the times I have
used SCSI devices, I haven't been able to disconnect SCSI peripherals
from a running Windows without negative consequences. But maybe my SCSI
hardware just has not been hot-pluggable.

Therefore, I have an additional question:

Are PCI hotplug (your first solution) and SCSI hotplug (your second
solution) supported by Windows Server 2008 R2 and (probably more
important) by the VirtIO drivers? Do I need the most recent version of
the drivers?

The following link seems to solve the problem of the missing sync command:
https://docs.microsoft.com/en-us/sysinternals/downloads/sync

I haven't tried it yet, but since it is from Mark Russinovich, I'll
trust it.

I also have thought of playing around with the mountvol command to mount
or dismount the disk within the guest, but I think this is a bad idea.

In any case, I'll begin to test now and report the results ...

Many thanks to all for any further comment,

Binarus



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux