Question

I have formated my pendrive and it is in /dev/sdb. When I execute the command dd if=/dev/sdb command it keep printing some junk in console. My doubt is, when I format the pendrive and execute this command, it should not print anything. But why it is printing ?

Était-ce utile?

La solution

Formatting a drive does not (generally) zero out the data; it simply writes data to certain locations on the drive such that your operating system believes that no space is allocated.

If you really want to zero out the data, you can run:

dd if=/dev/zero of=/dev/sdb bs=4096

This will write zeros to /dev/sdb.

Autres conseils

Formatting a device does not get rid of previous data on the device. All formatting will do is overwrite the filesystem data to make it marked as empty. Any previous data not overwritten will still technically exist. Also, dd will print out bytes of the raw data so even if you overwrite your drive with all 0s, dd would just return a whole bunch of zeros.

dd will print to STDOUT (terminal window) unless you give it an output file.

Example:

dd if=dev/sdb of=backup.img

Terminology:

  • dd: disk duplicator
  • if: input file
  • of: output file
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top