 Hello everybody! Watch this video to find out how to recover data after compacting a virtual hard disk. We will explore what types of virtual hard disks are there and how you can reduce the hard disk size of your virtual machine. When a virtual machine is created by the hypervisor, it receives a virtual hard disk of dynamic type by default. Such disks increase their size as more and more data is written to them. Unfortunately, their size doesn't shrink back when you remove any data from there. In the end, the virtual machine size keeps growing until the physical disk runs out of three space. To reduce the virtual machine disk size after deleting sound files, there is an option to compact the disk which can be found in your machine settings. In today's video, you'll see how to compact a virtual machine disk in such hypervisors as Wimware, Hyper-V and VirtualBox, and how to recover data from compacting disks. So what kind of disk is a dynamic one? It's the type of disk that lets you use the physical storage space efficiently. When you create a dynamic disk for the first time, its size is pretty small and it only takes as much storage space as it really needs. A dynamic disk grows in size as new data is added, and it helps to minimize the cost of storage. Besides, dynamic disks work well in development and testing environments and are pretty compatible with service running applications that don't require intensive use of storage devices. However, unless monitored properly, a virtual hard disk may increase to a maximum size consuming lots of physical storage space. And even deleting files from such virtual hard disks won't fix the problem. The only way to solve it is to reconfigure the disk manually by shrinking or compacting it. So what's the difference between shrinking and compacting virtual hard disks? When you shrink a virtual machine disk, you reduce its maximum size limit. When you compact a virtual disk, the physical storage space used by such virtual disk is reduced, and unused physical disk space becomes free. Disks can be shrunk inside the virtual machine in its disk management utility, and this is how you can extend or reduce the disk storage capacity. Meanwhile, disks can be compacted in virtual machine settings of the specific virtualization software that you are using. Now, let's explore how to compact a virtual disk file in VMware. You should understand that this action will reduce the disk size only if it has increased over time, and you have deleted some data recently. If you have just created a dynamic disk, its size will not change. However, if you created a dynamic disk, edit 5 gigabytes of data there, and then remove it, you'll be able to reduce its size to about the same 5 gigabytes. To reduce the virtual machine size in VMware, start the program, select the virtual hard disk you need to make smaller, and click here to edit virtual machine settings. In the window that opens, access the hard disk options. You will see its current size here. To reclaim the unused disk space, click on the comeback button, and it will start the process of rebuilding the disk contents and freeing up the space which is not used. In the end, the disk size will be reduced to the total size of the files it uses. For better cleanup results, recommend running disk to fragmentation. Now, let's see how to compact a virtual hard disk in HyperV. You're compacting a virtual hard disk where you command empty in the recycle bin, performing the disk to fragmentation, and then backing it up to protect important data against a disk failure. Such failure can make you lose data if there are any issues with starting the virtual machine or other problems. The process reduces the virtual hard disk size by removing empty blocks. You should also remember that it's impossible to compact a fixed-size virtual hard disk. The virtual machine, using the disk which you want to compact, should be powered off. With HyperV Manager, right-click on the virtual machine and choose settings. Open hard drive settings and click on the added button on the right. Move on to the next step at once, since you have already chosen the right virtual disk file. Click Next. In the Choose Action page, select Compact. In the next window, you'll be able to check what changes you are going to make to this disk. Click Finish to start the process. To make sure that the file size has actually decreased, click on the Inspect button. In Oracle VirtualBox, you can compact a dynamic virtual disk with the help of the command prompt. Depending on the disk type, there are several ways of compacting. If you are using a VHD disk, it can be compacted with a disk part utility integrated into Windows. Shut down the virtual machine, the disk which you want to compact, open the command prompt as administrator, and run the disk part command to start the utility. After that, choose the disk to be compacted by using disk command. You should type the path to the virtual disk file. To compact the disk, run disk command. This process can take quite a long time depending on the actual size of the virtual disk. If the compact process is successful, you will see this message on the screen. Disk part successfully compacted the virtual disk file. Now you should dismount your disk with disk command. After that, you can run the virtual machine again. If you are using a VDI disk, use the command prompt to navigate to the folder where Virtual Box is installed. After that, run Vbox Manager with the command Modify HD, the path to the virtual disk and the compact key. This is going to take some time depending on the size of the virtual disk. As you have already noticed, the virtual hard disk size can only be reduced manually. If you decide to just remove its contents, you will free some space on the virtual hard disk, but it will not affect the physical hard disk. To free up some space on the physical disk as well, you need to shrink or compact virtual hard disks depending on what you need to do. Before you start the shrinking or compacting process, it's always better to be prepared to the worst scenario possible. The unexpected system error or failure may render all your infrastructure inaccessible, so you need to make sure that the data stored in your disks is reliably protected and can be successfully recovered in case the hard disk fails. A specialized data recovery software tool, Hetman Rate Recovery, will help you restore data if it gets lost. This utility supports all popular file systems and can recover data from virtual hard disks even including compacting disks. If you have lost some data in the process of compacting a virtual hard disk, just download, install and run Hetman Rate Recovery. To have the virtual disk displayed in the program's window, you should upload it. To do it, click on Tools, Mount Disk, select the virtual machine type from which the data should be recovered, and click Next. Specify the location of the virtual disk file, select the folder where the file is stored, and click OK. Select the disk file, Next. After that, the mounted disk will appear in the program's window. Right-click on the disk and choose Open. At the next stage, select the scan type. For starters, we recommend choosing Fast Scan, as it will take less time and help you recover data in most cases. If the program fails to file the necessary files, then run Full Analysis. To do it, return to the main menu, right-click on the disk and choose Analyze again. After that, select Full Analysis, specify the file system type of this disk, uncheck the box for Content Aware Analysis to accelerate the scan process, and hit Next. In my case, the Fast Scan was enough. The program managed to find all files stored on the virtual disk, including the deleted ones, and this category is marked with the right cross. You can use the Preview window to see the contents of all files. In order to recover the data, select the necessary files and folders and click Recovery. After that, specify where to save the data, choose a disk and folder, and then hit the Recovery button. When the process is over, you will find the recovered files in the folder you have chosen for saving them. This is how you will be able to recover data from a virtual hard disk after it was compacted, regardless of the hypervisor which was used to create this specific virtual machine, be it WinWare, HyperV, VirtualBox, and so on. And that is all for now. Hopefully, the video was useful. Remember to click the Like button and subscribe to our channel. Leave comments under this video to ask questions. Thank you for watching. Good luck.