Clearing the unallocated disk space

Heinz Diehl htd+ml at
Sun Nov 16 21:37:37 UTC 2014

On 16.11.2014, Tom Horsley wrote: 

> A way is to run as root "cp /dev/zero tempfile" for one "tempfile" per partition
> until the cp fails due to running out of disk space. That will allocate all
> free space and write zeroes to it.

Yes. Or "dd if=/dev/zero of=bigfile bs=1M", which is the same. Delete
"bigfile" afterwards, and you are done. A single overwrite is enough.

On a SSD, you should issue the above command after booting from an
external medium and run fstrim after you deleted the bigfile.

More information about the users mailing list