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.
 
  • Like
Reactions: Gavino and ITT
I also suspect it's a Windows issue. I am running PVE enterprise subscription v9.2.4 with uname -a
Linux gtpve01 7.0.14-4-pve #1 SMP PREEMPT_DYNAMIC PMX 7.0.14-4 (2026-07-07T07:27Z) x86_64 GNU/Linux

All on the same PVE node are two Windows Server 2022 VMs, and one Windows Server 2019 VM. I just checked at the Windows Server 2019 still trims just fine. The two Windows Server 2022 VMs used to trim but now they don't. I bring up dfrgui.exe as admin and try to optimize within that, or run in PowerShell "Optimize-Volume -DriveLetter C -ReTrim -Verbose" - both fail on the Windows Server 2022 VMs. PowerShell at least gives me a "CimException".

On the hosts that fail - that one last had a successful trim/optimise on 6 June 2026, just last month. The other one - we often delay the Windows updates by a week or so for that one as there's more stuff to do when rebooting - it has three drives and they were last trimmed a bit later - one disk on 13th June 2026 and two disks on 14th June 2026. They are both set to trim weekly using a custom Windows Task Scheduler I setup which calls a PowerShell script.

Here are the versions of dfrgui.exe on the three Windows VMs:
Windows Server 2019 dfrgui.exe version: 10.0.17763.1697 (Date modified November 2022)
Windows Server 2022 dfrgui.exe versions: 10.0.20348.4893 (Date modified March 2026) - both have this version.

Code:
##Windows Server 2022 VMs #1 and #2 - broken Trims:
PS C:\Users\admin> (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


##Windows Server 2019 VM - working Trim:
PS C:\Users\admin> (Get-Item -Path "C:\windows\system32\defragsvc.dll").VersionInfo | Format-Table -AutoSize

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

So at this stage I am suspecting a recent Windows Update being the cause of the issue, given that my Windows Server 2019 box still trims fine. Hopefully the legends at Proxmox can make Microsoft aware?
 
Last edited:
I encounter a similar maybe related trim problem that is solvable by reducing the machine version to 9.2+pve1. I was able to replicate this in a fully patches W2K25 server template in CEPH and ZFS.

 
  • Like
Reactions: Johannes S
Thanks for the cross-reference!
Sadly i can't reproduce the change on my end. My 2025 VM still reports incrorrect function after changing back to 9.2+pve1 from 11.0+pve1.
Could you please share your VM config for reference?

Best regards
Jonas