HomeMicrosoft Hyper-VHow to Compact Virtual Hard Disk in Hyper-V

How to Compact Virtual Hard Disk in Hyper-V

In this article, we will guide you through the process of compacting a virtual hard disk in Hyper-V. While the shrinking operation reduces the capacity of the disk, the compact operation removes empty blocks, effectively reducing the file size of the virtual hard disk without affecting its capacity. Keep in mind that compacting cannot be applied to fixed virtual hard disks.

Before proceeding with compacting or shrinking a virtual hard disk, follow these steps:

  1. Empty the recycle bin on the virtual machine.
  2. Defragment the disk to consolidate free space.
  3. Create a backup of critical data to protect against potential hard disk failure.

For more detailed guidance, visit Appuals.

Compact Virtual Hard Disk: Step-by-Step

  1. Turn off the Virtual Machine:
    • The virtual machine using the disk must be powered off before you can perform the compact operation.
  2. Open Hyper-V Manager:
  3. Access Virtual Machine Settings:
    • Right-click on the virtual machine whose disk you want to compact and select Settings.
  4. Select the Hard Drive:
    • Under the IDE Controller 0, click on the Hard Drive to view the attached virtual hard disk settings.
  5. Edit the Virtual Hard Disk:
    • Click on the Edit button to launch the Edit Virtual Hard Disk Wizard.
  6. Locate the Disk Page:
    • The wizard will prompt you to locate the disk. Choose the appropriate virtual hard disk and click Next.
  7. Choose Compact Action:
    • From the action menu, select Compact and click Next.
  8. Verify Changes:
    • On the summary page, review the changes about to be made. If everything looks correct, click Finish to complete the process.
  9. Inspect the Disk:

After the process is complete, click on the Inspect button to verify that the virtual hard disk file size has been reduced.

Hyper-V manager

Click on the hard drive under IDE controller 0 to get access to the virtual hard disk attached to this virtual machine.
Choose the edit button to open the edit virtual hard disk wizard.

Hyper-V virtual machine settings

Edit the virtual hard disk wizard locate the disk page, and then choose next.

Locate virtual hard disk

In the choose action menu, simply select the compact action and then click next.

Compact virtual hard disk action

On the summary page, you need to verify the changes that are about to be made to the virtual hard disk. Click on the finish button to complete the action, and then close the wizard.

Compact virtual hard disk summary

Why Compact or Shrink Virtual Hard Disks?

The need to compact or shrink a virtual hard disk arises when you want to reduce its physical storage footprint on the host system. Simply deleting content from the virtual machine will free up space on the virtual hard disk but will not reduce the physical disk size on the host system. Compacting removes the unused blocks, effectively freeing up space on the physical disk.

Depending on your requirements, choose between compacting (to reduce file size) or shrinking (to reduce capacity) a virtual hard disk. Both operations help manage disk space more efficiently in virtual environments.

Learn more: How to Create and Delete Checkpoints in Hyper-V.

Jamil
Jamilhttp://jamiltech.com
A Professional Technology Blog Writer | An energetic professional with more than 20+ years of rich experience in Technology, Planning, Designing, Installation, and Networking.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments

Aluminium recycling tracking on How to Add Hyper-V Server Altaro VM Backup
تيشرتات اوفر سايز 2025 on How to Add NAS Backup Repository Veeam
화곡동출장마사지 on How to Backup and Restore IIS Configuration
what is cryptocurrency and bitcoin on How to Backup and Restore IIS Configuration
경기광주출장안마 on How to Backup and Restore IIS Configuration
영등포출장마사지 on How to Backup and Restore IIS Configuration
Twalsu light mirror for vanity on How to Backup and Restore IIS Configuration
fitspresso analysis on How to Reset Microsoft 365 Password
historical landmarks tours for history buffs on How to Add Hyper-V Server Altaro VM Backup
9780443186882 PDF download on How to Migrate Active Directory 2012 to 2022
Shaik Mohammad Jaheer on How to Enable Night Light on Windows 11