• Most COVID-19 rules have ended in New Zealand.
    • You must still isolate for 7 days if you have COVID-19.
    • You must wear a face mask in healthcare facilities, such as hospitals. International travellers will not need proof of COVID-19 vaccination.
    From 13 September 2022, to enter New Zealand, you do not need proof of vaccination.

Andy

Administrator
Creative Team
User ID
1
Joined
7 Jan 2019
Messages
771
Reaction score
32
Points
28
Do you have a Linux VM on a Hyper-V with a bloaty .VHDX?

Then you are on the right page, follow these instructions down below:

The idea is you need to TRIM your thin-provisioned drive first before you can compact your .VHDX
  1. Run fstrim on the Linux system.
    fstrim has become my personal favourite method when it comes to trimming SSD on Linux systems, here are some of the reasons:
    • It works very quickly
    • It doesn't cause unnecessary wear on SSDs
    • It ships in the default tool set of most distributions
    • It's ridiculously simple to use
    Usage:
    Bash:
    sudo fstrim /
  2. Now we need to shut down our Linux VM (I couldn't find any better way than shutting down as Optimize-VHD cmdlet requires full access over the .VHDX while doing its job) -- if you find a better way, please share with us here by commenting down below.
  3. Run PowerShell as administrator and then run Optimize-VHD on the target .VHDX.
    Example Usage:
    Optimize-VHD 'D:\CANA\Virtual Hard Disks\CANA.vhdx' -Mode Full
My D drive which was 6 GB free of 465 GB total disk space, by performing the maintenance above, I managed to get 164 GB free of 465 GB total disk space. That's heaps of disk space reclaim 🌈🥳
 
 Short URL:
Top