Win2025 retrim fails with "Data error (cyclic redundancy check). (0x80070017)" while Win11 OK

hpaluch-pil

Member
Mar 31, 2022
5
1
23
Found that on fresh Win2025 server install (+latest updates) retrim fails with strange errors:
Code:
C:> defrag c: /l /v

Invoking retrim on WIN20256-STD (C:)...

        Retrim:  skipped.

Data error (cyclic redundancy check). (0x80070017)

Event log shows two items:
Code:
The storage optimizer skipped slab consolidation on WIN20256-STD (C:) because: Slab size is too small. (0x8900002D)
The storage optimizer couldn't complete retrim on WIN20256-STD (C:) because: Data error (cyclic redundancy check). (0x80070017)

While Win10 and Win11 guest finish same command without error (I use this retrim command for many years on Desktop Windows guests).

Failing guest info:
  • Windows Server 2025 Standard, ver output: 10.0.26100.32995
  • Virtio Drivers: BLK (known as "viostor" under Win) tested 0.1.271 and 0.1.285 with same error results
YAML:
agent: 1
bios: seabios
boot: order=virtio0;ide0;net0
cores: 4
cpu: x86-64-v2-AES
description: [REDACTED]
ide0: none,media=cdrom
machine: pc-q35-11.0
memory: 8192
meta: creation-qemu=11.0.0,ctime=1782800479
name: win2025-std
net0: virtio=BC:24:11:57:85:D3,bridge=vnetnat1,firewall=1
numa: 0
ostype: win11
scsihw: virtio-scsi-single
smbios1: uuid=7a54ccab-bc38-4d3f-8659-9eeba54ff524
sockets: 1
vga: qxl
virtio0: nvme:260630001/vm-260630001-disk-0.qcow2,cache=writethrough,discard=on,iothread=1,size=55G
vmgenid: 0135fc04-00f8-4aab-b7a8-90eda5c23806

Host info:
  • Proxmox VE 9.2.3
  • one host has Enterprise repository (pveversion: pve-manager/9.2.3/d0fde103346cf89a (running kernel: 6.17.13-7-pve)), other one Community (pveversion: pve-manager/9.2.3/d0fde103346cf89a (running kernel: 7.0.12-1-pve)). Both hosts use same pve-qemu-kvm: 11.0.0-4

Question: Does anybody else experience same error?
 
Hi @hpaluch-pil

thanks for posting on the forum!

I just reproduced your setup with current Windows Server 2025 VMs in different configurations and found that the operation only fails after applying the latest updates.
With the initial 26100.1742 from 09/2024 the defrag operation succeeds.
It is independent of usage of VirtIO Block or SCSI and also occurs on ZFS and Ceph backed storage.
The only difference is that with Block the error is Data error (cyclic redundancy check). (0x80070017) and with SCSI it is Incorrect function. (0x80070001)

Did you notice a specific version where this started to happen?

Either way i will try to narrow down when this broke and why.

Best regards
Jonas
 
Thanks for the report.

For the SLAB consolidation skipped, set :
args: -global scsi-hd.discard_granularity=8M -global virtio-blk-pci.discard_granularity=8M
in VM .conf for Windows since 10 v2004 and Server 2022
 
I have found that faulty component is C:\windows\system32\defragsvc.dll - when I copy it from original (working) Win 2025 the defrag c: /l /v command will work again.

Working version of C:\windows\system32\defragsvc.dll:
Code:
# modified powershell command from: https://stackoverflow.com/a/76680113
(Get-Item -Path "C:\windows\system32\defragsvc.dll").VersionInfo | Format-Table -AutoSize

ProductVersion FileVersion                         FileName
-------------- -----------                         --------
10.0.26100.1   10.0.26100.1 (WinBuild.160101.0800) C:\windows\system32\defragsvc.dll
# dir:
03/06/2025  10:05 AM           561,152 defragsvc.dll

Broken DLL (from latest Windows 2025 with updates):
Code:
# powershell
 (Get-Item -Path "C:\windows\system32\defragsvc.dll.orig").VersionInfo | Format-Table -AutoSize

ProductVersion   FileVersion                             FileName
--------------   -----------                             --------
10.0.26100.32995 10.0.26100.32995 (WinBuild.160101.0800) C:\windows\system32\defragsvc.dll.orig

# dir:
06/29/2026  11:59 PM           598,016 defragsvc.dll.orig

Note: you have to become "TrustedInstaller" user to be able to rename/replace C:\windows\system32\defragsvc.dll (there are tools on Internet that can do that).
 
I have found that faulty component is C:\windows\system32\defragsvc.dll - when I copy it from original (working) Win 2025 the defrag c: /l /v command will work again.

Working version of C:\windows\system32\defragsvc.dll:
Code:
# modified powershell command from: https://stackoverflow.com/a/76680113
(Get-Item -Path "C:\windows\system32\defragsvc.dll").VersionInfo | Format-Table -AutoSize

ProductVersion FileVersion                         FileName
-------------- -----------                         --------
10.0.26100.1   10.0.26100.1 (WinBuild.160101.0800) C:\windows\system32\defragsvc.dll
# dir:
03/06/2025  10:05 AM           561,152 defragsvc.dll

Broken DLL (from latest Windows 2025 with updates):
Code:
# powershell
 (Get-Item -Path "C:\windows\system32\defragsvc.dll.orig").VersionInfo | Format-Table -AutoSize

ProductVersion   FileVersion                             FileName
--------------   -----------                             --------
10.0.26100.32995 10.0.26100.32995 (WinBuild.160101.0800) C:\windows\system32\defragsvc.dll.orig

# dir:
06/29/2026  11:59 PM           598,016 defragsvc.dll.orig

Note: you have to become "TrustedInstaller" user to be able to rename/replace C:\windows\system32\defragsvc.dll (there are tools on Internet that can do that).
This seems to be related to https://github.com/virtio-win/kvm-guest-drivers-windows/issues/1574

I'll fold that information in.
 
  • Like
Reactions: j.theisen
I have found that faulty component is C:\windows\system32\defragsvc.dll - when I copy it from original (working) Win 2025 the defrag c: /l /v command will work again.

Working version of C:\windows\system32\defragsvc.dll:
Code:
# modified powershell command from: https://stackoverflow.com/a/76680113
(Get-Item -Path "C:\windows\system32\defragsvc.dll").VersionInfo | Format-Table -AutoSize

ProductVersion FileVersion                         FileName
-------------- -----------                         --------
10.0.26100.1   10.0.26100.1 (WinBuild.160101.0800) C:\windows\system32\defragsvc.dll
# dir:
03/06/2025  10:05 AM           561,152 defragsvc.dll

Broken DLL (from latest Windows 2025 with updates):
Code:
# powershell
 (Get-Item -Path "C:\windows\system32\defragsvc.dll.orig").VersionInfo | Format-Table -AutoSize

ProductVersion   FileVersion                             FileName
--------------   -----------                             --------
10.0.26100.32995 10.0.26100.32995 (WinBuild.160101.0800) C:\windows\system32\defragsvc.dll.orig

# dir:
06/29/2026  11:59 PM           598,016 defragsvc.dll.orig

Note: you have to become "TrustedInstaller" user to be able to rename/replace C:\windows\system32\defragsvc.dll (there are tools on Internet that can do that).

"The storage optimizer couldn't complete retrim on ( C: ) because: Incorrect Function. (0x80070001)"
Across all of my VMs this issue is occurring, even on my older install of Windows Server 2022 build 20348 and defragsvc.dll:


PS C:\Windows\system32> (Get-Item -Path "C:\windows\system32\defragsvc.dll").VersionInfo | Format-Table -AutoSize

ProductVersion FileVersion FileName
-------------- ----------- --------
10.0.20348.1 10.0.20348.1 (WinBuild.160101.0800) C:\windows\system32\defragsvc.dll


I also find it suspicious this issue presented exactly at the same time I migrated to PVE 9 on all of my hosts...
 
I also find it suspicious this issue presented exactly at the same time I migrated to PVE 9 on all of my hosts...
Curious but according to my research it is unrelated.
I just spun up and updated a Windows Server 2025 on a current PVE 8.4.19 machine and still got the "Not supported" / "Incorrect function".
I know you said you run WinSrv 2022 and i will try that tomorrow but currently it seems unrelated imho

Best regards
Jonas
 
Yes, it just seems very odd to me.

Across 2 physical locations, 4 guests running Windows Server 2022, 1 guest running Windows Server 2025 which were all had trim working up until June 16th/17th-ish when I migrated 3 nodes from PVE 7 -> 9 (fresh install), and one from 8 -> 9 (in-place upgrade).
 
Yes, it just seems very odd to me.

Across 2 physical locations, 4 guests running Windows Server 2022, 1 guest running Windows Server 2025 which were all had trim working up until June 16th/17th-ish when I migrated 3 nodes from PVE 7 -> 9 (fresh install), and one from 8 -> 9 (in-place upgrade).
I also suspect this is unrelated.

While My Windows 11 VM stopping trimming after Microsoft's 11 May 2026 Patch Tues update, an adjacent Windows 10 VM, on the same hypervisor, with the same 0.1.285 virtio-scsci drivers, continues to have functional trim support on Proxmox 9.2.3.

I believe Microsoft's Update changes are the cause here, not Proxmox 9.
 
> while Win11 OK

In Windows 11, just like in Windows Server 2025, if you apply the latest cumulative update, it fails with the error “Invalid function (0x80070001),” right?

If this is caused by cumulative updates, you should contact Microsoft, but it appears this issue does not occur unless VirtIO is involved.

I don't think this issue occurs with NVMe devices that use PCIe pass-through, but it does occur even when passing through physical disks, not just virtual disks.
 
Last edited: