For my virtual machine host, I use Windows Server 2008r2 with role Hyper-V, while the guest VM is Ubuntu 12.04 LTS. It is located on a dynamic virtual hard disk (2TB). The size of this VM's VHD is 360 GB. But the real size shown within Ubuntu is about 50 GB.It's apparently not possible to reduce the size of this VHD using standard Hyper-V tools, because the file system used by the Ubuntu VM is not NTFS.Is there another way of doing it on Ubuntu that would result in resetting the free space on the VHD outside?
How can I fill free disk space with zeroes so that my virtualization host can stop thinking it's used?
filesystems
How can I fill the free space with zeroes in Ubuntu 12.04 (ext4)?It's rather simple:dd if=/dev/zero of=/some/path/to/zerofile bs=128M count=NumOf128MBlocksToFillTheDiskWithYou'd better have some space left untouched with that commands, say 1 %. By default EXTFSes have special amount of reserved space for root user (AFAIR, 5 %), so in case you'd run this command as ordinary user, you won't fill up the whole disk, and that's great, since another system software running as root may malfunction in that case. But even running this dd as ordinary user you'd better not use the rest available space (95 %), otherwise other programms like, say Firefox, wouldn't be happy to realize they can't write to disk anymore and you may end up with inconsistent data. So leave the space untouched. It'd be even better to run this in single mode, then you'd squeeze the maximum and won't hurt anything.After that, needless to say, but just in case  simply remove /some/path/to/zerofile.P. S. Thanks to @Weijian for sharing info regarding zerofree which does suit better for EXT2/EXT3/EXT4.