Why you should be compacting your hyperv virtual disks. You must first select the hyperv host that will be performing the compact, then select the vhdx that you want that host to compact. Compacting hyperv vhdx files of ubuntu linux vms note. If you configured your hyperv virtual machines with dynamically expanding virtual disks you will find that the vhdx files backing the virtual disks always grow in size, they never shrink. Compacting virtual hard disk files in hyperv solved windows 10 edition. I am describing the process of reducing virtual hard disk size using our ubuntu web server vm as an example. Compact a linux virtual hard disk on hyperv world of jani. Here is where you will see the option to compact the drive. I want to attach another vhd to the vm, and i know how to do that in hyperv i mount it as another ide drive, but it doesnt show up in ubuntu. How to compact a dynamic vhd virtualization spiceworks. The tool simply cleans all your deleted data off your vhd x and thats all there it is to it. How to reclaim storage space from hyperv virtual machines. Compact a linux vhdx for hyperv via powershell crackjet.
Before you compact a virtual hard disk, it is a good idea to defragment it. The os issues trim commands when files are deleted to tell the disk that the blocks occupied by the files can be used elsewhere. This mechanism originally developed for ssds is useful for virtual hard disks, too. I do not know which method it uses, but youll discover very quickly that it is not the equivalent of powershells full. How to compact or reduce size of virtual hard disk vhd in hyper v. The process takes a good amount of time to complete but in the end, can save you lots of space if you are using dynamic drives. How do you add a vhd to a linux vm in hyperv solutions. The compact operation is used to optimize the files.
The next step is to go into the hyperv manager and open the settings of the virtual machine you wish to compact. Ubuntu running in a hyperv virtual machine has been supporting the trim command since version 14. I want to compact this vhd the real size is 50 gb, 360 gb on the disk. But i can not do this, because the ubuntu file system is not ntfs. Precompact does just that prepares you dynamically expanding vhd x for compaction. In this video i demonstrate the solution for maximizing the compact disk feature in microsoft hyperv, used to reduce the size of dynamic virtual disks.1043 120 1237 484 1331 953 96 1275 43 1050 1507 1020 1201 636 306 1004 1393 1466 17 1439 568 1223 920 1192 702 494 54 367 837 657 653 670 1139 1431 1496 806 274 1062 229 316 1299 1288 247 829 576 1463