2

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...

Matthieu
  • 323
  • 3
  • 7

1 Answers1

7

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.

x539
  • 162
  • 5