How to defragment a disk in a windows guest


Jan 5, 2023
Hi all,
So I have a PVE 7.4-16. On it I have a RAID controller (no ZFS) that exposes a RAID6 array of SAS HDDs to PVE. These are not SSD drives !
PVE is using LVM on top of RAID-provisioned drive name.

I have a Windows Server 2022 guest. The disk is stored RAW on PVE LVM-based storage that uses this RAID6 array of HDDs. I'm using VirtIO SCSI single.
Now I sometimes want to defrag a volume inside guest (reason being it's plain old HDD rust in a RAID, not ZFS, no SSD).

But, Windows Server 2022 guest shows it's disks as "thin provisioned". And wants to only do TRIM on it. Which is wrong, because the guest disk is actually thick-provisioned. So how do I explain my windows guest that I have a normal HDD setup underneath and that I WANT to do a normal defrag ? Anyone knows ?
Is it really LVM or LVM-Thin? As virtual Disks stored on the default "local-lvm" are using LVM-Thin and are therefore thin-provisioned.
Is it really LVM or LVM-Thin? As virtual Disks stored on the default "local-lvm" are using LVM-Thin and are therefore thin-provisioned.

It's LVM, not LVM-Thin - it's not a default datastore.

I think the problem is the guest is detecting disk type wrong but I don't know what causing it.
Also I do need to defragment from time to time, this TRIM/UNMAP doesn't serve any purpose in my setup.

Again: thick LVM raw disks, backed by a hardware RAID of spinning HDDs. No ZFS, no SSD. Can't defrag in guest, it only wants to TRIM it.
Or maybe I'm getting something wrong... anyway this is how it looks in Win Svr 2022 guest:


  • defrag.png
    22.9 KB · Views: 10
Actually, to be more precise. The C drive is backed up by an SSD.
The problem I'm having is the other drives: D, E, F. They are backed up by LVM (thick) on top of (server-grade hardware RAID) of HDDs. Those I need to be able to defrag from time to time and windows seems to think these are SSD-s.
"thin provisioned drive" is seen by Windows because use of virtio scsi.
you can switch to regular sata to expose regular hdd to Windows.
  • Like
Reactions: lucius_the
Thank you, but...
What does that mean - if I want to use a defragmenter in guest I can't use virtio SCSI ? It that a bug or something ?
To confirm: yes, detaching a disk and reattaching it as SATA enables allows windows guest to properly recognize the drive and enables defragging.
I am using VirtIO for all drives as that's recommended for performance. Will have to test what's happening with IOPS and CPU usage now that I switched to SATA...


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!