Optimize-VirtualDisk
2024.6.2
Defragments partitions of a virtual hard disk using the Optimize-Volume cmdlet and optimizes the virtual hard disk
file using Optimize-VHD.
This cmdlet can be used on virtual hard disk files (VHD or VHDX) on disk, or on virtual machines.
When targeting virtual machines, the virtual machine will have its virtual hard disk files defragmented and
optimized only i
file using Optimize-VHD.
This cmdlet can be used on virtual hard disk files (VHD or VHDX) on disk, or on virtual machines.
When targeting virtual machines, the virtual machine will have its virtual hard disk files defragmented and
optimized only i
Defragments partitions of a virtual hard disk using the Optimize-Volume cmdlet and optimizes the virtual hard disk
file using Optimize-VHD.
This cmdlet can be used on virtual hard disk files (VHD or VHDX) on disk, or on virtual machines.
When targeting virtual machines, the virtual machine will have its virtual hard disk files defragmented and
optimized only if the virtual machine does not have a snapshot, and if its virtual hard disk files are not part of
another virtual machine's snapshot.
------------- The Optimization Process -------------
Only partitions with drive letters (e.g.: C:\) will be defragmented. Partitions without drive letters will be
skipped.
For each valid partition on the virtual hard disk the following commands will be ran:
Optimize-Volume -Defrag is ran on the partition.
All files on the partition are defragmented to be contiguous
Optimize-Volume -SlabConsolidate -ReTrim is ran on the partition.
All defragmented data is consolidated towards the start of the partition and excess file size is trimmed.
Optimize-Volume -Defrag is ran on the partition.
The partition again is defragmented again to ensure no leftover fragmentation is present from moving data
during the slab consolidation and re-trim.
Optimize-Volume -SlabConsolidate is ran on the partition.
All defragmented data is consolidated once more towards the start of the partition.
After all partitions are defragmented the optimization concludes with running Optimize-VHD on the virtual hard
disk.
Show more
file using Optimize-VHD.
This cmdlet can be used on virtual hard disk files (VHD or VHDX) on disk, or on virtual machines.
When targeting virtual machines, the virtual machine will have its virtual hard disk files defragmented and
optimized only if the virtual machine does not have a snapshot, and if its virtual hard disk files are not part of
another virtual machine's snapshot.
------------- The Optimization Process -------------
Only partitions with drive letters (e.g.: C:\) will be defragmented. Partitions without drive letters will be
skipped.
For each valid partition on the virtual hard disk the following commands will be ran:
Optimize-Volume -Defrag is ran on the partition.
All files on the partition are defragmented to be contiguous
Optimize-Volume -SlabConsolidate -ReTrim is ran on the partition.
All defragmented data is consolidated towards the start of the partition and excess file size is trimmed.
Optimize-Volume -Defrag is ran on the partition.
The partition again is defragmented again to ensure no leftover fragmentation is present from moving data
during the slab consolidation and re-trim.
Optimize-Volume -SlabConsolidate is ran on the partition.
All defragmented data is consolidated once more towards the start of the partition.
After all partitions are defragmented the optimization concludes with running Optimize-VHD on the virtual hard
disk.
Minimum PowerShell version
5.1
Installation Options
Owners
Copyright
Copyright (c) 2024 AJ Tek Corporation. All Rights Reserved.
Requires License Acceptance
Package Details
Author(s)
- AJ Tek Corporation
Tags
Defrag Optimize Optimise VHD VHDX
Functions
PSEditions
Dependencies
This module has no dependencies.
FileList
- Optimize-VirtualDisk.nuspec
- Private\GetVMHardDriveMap.ps1
- Private\OptimizeVirtualDisk.ps1
- Private\ProcessPipelineObject.ps1
- Private\ProcessVirtualDiskPath.ps1
- Private\ProcessVirtualMachine.ps1
- Private\TestElevated.ps1
- Private\TestVHDFileValid.ps1
- Private\WriteCustomJobProgress.ps1
- Public\Optimize-VirtualDisk.ps1
- license.txt
- Optimize-VirtualDisk.psd1
- Private\FormatHumanReadable.ps1
- Optimize-VirtualDisk.psm1
Version History
Version | Downloads | Last updated |
---|---|---|
2024.6.2 (current version) | 308 | 6/6/2024 |