Re: hard-disk via virtio-blk under windows (discard_granularity=0)

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

 



On Thu, Nov 14, 2024 at 01:02:02AM +0800, d tbsky wrote:
Hi:
  few years ago virtio-blk device was showing as hard-disk under
windows. recent years the driver change the device to show as
thin-provisioned disk.  the change is good for ssd, but not so good
for raw hard-disk.

  under windows server 2022 the default virtio-blk situation is quite
bad, ssd trim is very slow. and defrag a bigger volume like 1TB
harddisk will always show "memory not enough", even when the volume is
empty.

 I found discussions to change the "discard_granularity" to make trim
happy again. and libvirt support the syntax like below:

  <blockio discard_granularity='2097152'/>

  I also found if I can set "discard_granularity" to zero, then
windows will recognize the device as "traditional hard drive" again
and won't do unnecessary trim to it. I want to do this for years, but
couldn't find a way to set it up like vitio-scsi's rotational
parameter.

  the sad part is if I setup it under RHEL 9.4 with librirt 10.0 like below:

 <blockio discard_granularity='0'/>

  the line will just disappear when I close "virsh edit"


That is because we treat '0' as the default.  Unfortunately that value
in QEMU does not mean the same as for us as QEMU defaults to logical
block size and discard_granularity=0 actually changes the behaviour.

   so I can only use complex  format with "<qemu:override>" to set
"discard_granularity='0'"

    I wonder if libvirt  would be changed to accept
"discard_granularity='0'" so the traditional hard-disk can be
recognized under windows again.


That should be possible, yes.  Given the behaviour described above it
should be done (although it feels like there is something else that's
worth fixing, but I don't know what and where).

Could you file an upstream (or downstream) issue so that we do not lose
track of this?

Upstream: https://gitlab.com/libvirt/libvirt/-/issues/new
Downstream: https://issues.redhat.com/secure/CreateIssue!default.jspa

    or is there better ways to distinguish hard-disk/ssd/thin-disk
for virtio-blk now?


Based on whether it is taking time in the guest or in the host you could
theoretically try setting <driver name='qemu' discard='ignore'/> but I
guess that would not help.

Other than that I don't know about any other option.

Regards,
tbskyd

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux