dd: zero-out all the remaining unused space of a drive
The /zero-Tag is actually a file name. The command just copies zeros from the virtual File /dev/zero
(infinite number of zeros) into /mnt/hdb/zero
until the disk is full, or some other error occurs.
This is why you have to remove the file /mnt/hdb/zero
after that in order to regain the unused space.
However, a better way to fill free space with zeros (on ext2,3,4 file systems) is to use a tool called zerofree.
Related videos on Youtube
Matthieu
Updated on September 18, 2022Comments
-
Matthieu over 1 year
In the second answer of this question about disk cloning with 'dd', I read this command:
dd if=/dev/zero of=/mnt/hdb/zero
It is supposed to write '0' in the unused space of drive 'hdb', however I can't find any documentation about this
/zero
tag appended to the mounted hard drive.I understand the first part (
if=/dev/zero
is a virtual device that "creates" zeros), but what does/mnt/hdb/zero
mean exactly? Does this really map to the unused space of a drive? Is this a typo?I don't want to run it on my drive before being sure it won't do any harm...