the zerofree
command finds the unallocated, non-zeroed blocks in an ext2 or ext3 file-system and fills them with zeroes
A NTFS Windows machine, with a mechanical drive, was upgraded from 7 to 10. The drive is old and I suspect that much of the free space actually has data and not filled with zeros.
Is it possible (how?) to zero out the free space, so that when an image is created, the size is minimal?
Assume either a bootable USB configured with Ubuntu or SysRescueCD is available to process the HDD by mounting the NTFS partion with NTFS-3G
if necessary
dd if=/dev/zero of=/mount/path/bigtmp
. This is also an fs-independent option. Although it might be not perfect, for example deleted directory entries might remain allocated, depending on how ntfs handles them. Doing a defrag and then this zero-file is probably close to be perfect. – peterh Jun 07 '20 at 23:06