StarWind Virtual Tape Library (VTL) OEM.Let’s take a look at the result: PS C:\> dir 'D:\VMs\www1-ubuntu\Virtual Hard Disks' The PowerShell command line above processes all VHDX files below a given base directory (D:\VMs), mounts each file read-only, compacts it and dismounts it. The actual size reduction of the VHDX file(s) is performed on the Windows host command line as follows: PS C:\> gci -File -Filter *.vhd* -Path D:\VMs -Recurse | % Rather a lengthy service not available kind of thing. So no quick online no-downtime operation. Unfortunately the VM needs to be shut down for the size reduction. But we can politely convince Linux to fill all deleted blocks with nulls using the following commands: sudo apt-get install secure-delete For performance reasons the OS does not do that but simply marks those blocks as deleted, keeping the actual data as it is. The key to success is to zero all deleted blocks on the disk. (Above screenshot was taken at a later time, thus the different size) Preparation Of course, you can get the same information from Hyper-V Manager’s GUI, too, by inspecting the virtual hard drive: Wow, that’s a whopping 60 GB! The VHDX’ size more than doubled! Let’s see what we can do about that. Let’s take a look at the current size: PS C:\> dir 'D:\VMs\www1-ubuntu\Virtual Hard Disks'ĭirectory: D:\VMs\www1-ubuntu\Virtual Hard Disks I distinctly remember that the VHDX size was approximately 24 GB when I installed the machine about 1.5 years ago. I am describing the process of reducing virtual hard disk size using our Ubuntu web server VM as an example. This article shows how to do it for Ubuntu Linux VMs. I have described the process for Windows VMs here. Compacting VHDX files is possible but more complicated than I feel it should be. Eventually this becomes a problem either directly because of increased storage requirements or indirectly because backups take longer. If you configured your Hyper-V 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. Note: if your guest OS supports the trim command you can use the faster method described in this article.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |