If I issue the following command to completely erase a disk, will it automatically stop when the disk is full, or do I need to specify the count option?:
sudo dd if=/dev/zero of=/dev/disk7 bs=64m
I should mention this os OS X 10.9.
If I issue the following command to completely erase a disk, will it automatically stop when the disk is full, or do I need to specify the count option?:
sudo dd if=/dev/zero of=/dev/disk7 bs=64m
I should mention this os OS X 10.9.
completely erase a disk
If your goal is to make a mechanical disk (HDD) securely erased so that it is impossible, even in principle, for someone to get their hands on it and recover the data, you should not be using /dev/zero as the source, and you should be writing over it more than once. See wikipedia and about.com.
If you don't care about security, /dev/zero is fine, but then, so is just putting a new partition table on the device.
I really can't see a valid use case for writing /dev/zero onto physical media, because:
automatically stop
Of course. What do you think it's going to do, keep writing onto the next file?
You specifically specify the of option, which means "output file". It will open that block device and write until it reaches the end of the block device, then exit. This is normal behavior for dd.
do I need to specify the
countoption?
You'd only do that if you want it to stop writing at some point before it reaches the end of the block device, or if you're writing to a regular file (i.e., not a block device) and you want it to stop before it fills up the filesystem that the file sits on.
Some closing notes:
dd on it after mounting it on a loopback device, then run dd on it. count specified, dd will stop when the first of one of the following conditions occurs: either the if (input file) throws an EOF (end of file), or the operating system throws a signal indicating that the last block of of (output file) has been reached.