Windows VM requires lots of ram to trim larger hard disks

Jan 2, 2021
17
0
6
40
Not sure if this is a bug, setting, or limitation. I'm on the latest version of proxmox, with the latest version of the virtio drivers installed, I have a windows 10 vm with a 1TB hard disk attached. I have it set as an SSD with trim enabled. The issues arises when windows actually tries to trim the drive. It requires 24GB of memory on the VM before it will complete any less and it will throw an out of memory exception. Watching task manager it will use about 21gigs of the 24 while it's trimming. I initialy had a 6TB disk attached to the vm and that requires 64 gigs of memory iirc. Anyone know what is happening here? Doesn't seem to affect my nix VM's.
 
hi,

that's weird, can you post the VM configuration?

Watching task manager it will use about 21gigs of the 24 while it's trimming.
is it the Secure file delete process using that much memory or something else?
which version of sdelete are you using? on my system it never goes beyond a couple of megabytes of RAM while trimming a terabyte virtual disk.
 
hi,

that's weird, can you post the VM configuration?


is it the Secure file delete process using that much memory or something else?
which version of sdelete are you using? on my system it never goes beyond a couple of megabytes of RAM while trimming a terabyte virtual disk.
Thanks for the reply attaching a screenshot of the config.

I'm not sure what you are referencing with the Secure file delete vs sdelete, that might be something I'm not aware of. Is that a setting in proxmox or in the VM OS?
 

Attachments

  • Capture.JPG
    Capture.JPG
    67.1 KB · Views: 50
I'm not sure what you are referencing with the Secure file delete vs sdelete, that might be something I'm not aware of. Is that a setting in proxmox or in the VM OS?
how are you trimming the windows VM? normally sdelete tool from windows sysinternals is used for zeroing the virtual disk inside the VM, so that's what i was referring to.
which process is using up the memory according to windows task manager?
 
how are you trimming the windows VM? normally sdelete tool from windows sysinternals is used for zeroing the virtual disk inside the VM, so that's what i was referring to.
which process is using up the memory according to windows task manager?
oh i see. i was just letting windows defrag do the optimization/trim that's what is chewing all the memory and erroring out. See error below.

Code:
The storage optimizer couldn't complete slab consolidation on Storage (D:) because: Not enough memory resources are available to complete this operation. (0x8007000E)
 
try installing sdelete from the sysinternals page [0] and do sdelete -z C: (or a different drive letter if that's the case). that will zero out the space and perform a trim.

[0]: https://docs.microsoft.com/en-us/sysinternals/downloads/sdelete
That doesn't look like a tool that would trim to reclaim free space for a thin provisioned disk, that looks like a secure way to erase free space to prevent recovery. While a nice tool that I wasn't aware of, I don't think that will accomplish the same thing as disk optimizations trim function. The disk I'm trying to trim fluctuates a bit over time and I like to reclaim that space if possible.
 
That doesn't look like a tool that would trim to reclaim free space for a thin provisioned disk, that looks like a secure way to erase free space to prevent recovery.
it can do both :)

Code:
SDelete v2.04 - Secure file delete
Copyright (C) 1999-2019 Mark Russinovich
Sysinternals - www.sysinternals.com

usage: sdelete [-p passes] [-r] [-s] [-q] <file or directory> [...]
       sdelete [-p passes] [-z|-c [percent free]] <drive letter [...]>
       sdelete [-p passes] [-z|-c] <physical disk number>

   -c         Clean free space. Specify an option amount of space
              to leave free for use by a running system.
   -f         Force arguments containing only letters to be treated as a file/directory rather than a disk.
              Not required if the argument contains other characters (path separators or file extensions for example)
   -p         Specifies number of overwrite passes (default is 1)
   -r         Remove Read-Only attribute
   -s         Recurse subdirectories
   -z         Zero free space (good for virtual disk optimization)
   -nobanner  Do not display the startup banner and copyright message.

Disks must not have any volumes in order to be cleaned.

see the -z option. it's also mentioned in our wiki page about shrinking qcow2 disks, which includes trimming the disk in preparation [0]

please try and let me know if it helps

[0]: https://pve.proxmox.com/wiki/Shrink_Qcow2_Disk_Files#Windows_Guest_Preparation
 
Last edited:
it can do both :)

Code:
SDelete v2.04 - Secure file delete
Copyright (C) 1999-2019 Mark Russinovich
Sysinternals - www.sysinternals.com

usage: sdelete [-p passes] [-r] [-s] [-q] <file or directory> [...]
       sdelete [-p passes] [-z|-c [percent free]] <drive letter [...]>
       sdelete [-p passes] [-z|-c] <physical disk number>

   -c         Clean free space. Specify an option amount of space
              to leave free for use by a running system.
   -f         Force arguments containing only letters to be treated as a file/directory rather than a disk.
              Not required if the argument contains other characters (path separators or file extensions for example)
   -p         Specifies number of overwrite passes (default is 1)
   -r         Remove Read-Only attribute
   -s         Recurse subdirectories
   -z         Zero free space (good for virtual disk optimization)
   -nobanner  Do not display the startup banner and copyright message.

Disks must not have any volumes in order to be cleaned.

see the -z option. it's also mentioned in our wiki page about shrinking qcow2 disks, which includes trimming the disk in preparation [0]

please try and let me know if it helps

[0]: https://pve.proxmox.com/wiki/Shrink_Qcow2_Disk_Files#Windows_Guest_Preparation
oh, I see. Thanks for the tip. I'll give that a try, might set it up as a scheduled task if it works well.
 
talking about defragmenting, i was able to reproduce what you described in your first post. the disk defragmenter indeed uses a lot of memory when analyzing/optimizing the disks (but not as much as your case, for me it's around 8-10G). though this seems to be a windows specific problem and not related to proxmox in general. it could help with the memory usage during the defrag if you partition your disk into smaller parts. but at the moment i'm afraid the only "fix" would be adding more RAM to the VM and turning off other programs/services that use up memory while the defrag is going on.
 
Last edited:
talking about defragmenting, i was able to reproduce what you described in your first post. the disk defragmenter indeed uses a lot of memory when analyzing/optimizing the disks (but not as much as your case, for me it's around 8-10G). though this seems to be a windows specific problem and not related to proxmox in general. it could help with the memory usage during the defrag if you partition your disk into smaller parts. but at the moment i'm afraid the only "fix" would be adding more RAM to the VM and turning off other programs/services that use up memory while the defrag is going on.

I'm glad you were able to reproduce it that makes me feel a little better. I have a quite a bit of data on that disk (bit over half full) so that might also require more memory for defrag to process. It must be an interaction with the proxmox virtual disk driver and windows defrager, as I have physical windows 10 clients that do not experience this memory utilization when trimming a large 1TB ssd. In the end it isn't a huge issue I suppose.
 
Consider using sata port. I've reconnected my 6TB from SCSI to SATA and trimming started with 16GB RAM without errors.
 

About

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!