I found bad sectors on my usb external drive and so I want to perform a full wipe overwriting the disk with zeroes. I found this command:
sudo dd if=/dev/zero of=/dev/sd<disk-letter> bs=8M
and I have some questions:
Thank you! :)
The block size does not really matter when using dd
, it only affects the speed of the operation. Basically you should use 4M
or a multiple of that as block size. Smaller blocks make the process slower, but larger block sizes usually don't really speed it up much more.
Flash drives can't get bad blocks the way HDDs with spinning magnetic platters do. They consist of memory cells that wear out with every erase/overwrite.
Therefore such devices have a controller chip built in that works as wear leveller which tries to equally distribute the writes over all cells to make them last as long as possible. Normally good flash drives and SSDs also contain much more cells than declared as their capacity, so that even after some cells died, the device is still working because the controller still has enough working cells to assign.
If a flash drive/SSD starts to cause I/O errors, it's really at the edge of dying. There's nothing you can fix with overwriting everything with zeroes, the additional erase/write cycle just wears the cells out more. And due to the controller, you can't even be sure that (or rather, you can sure that not) all cells get overwritten once. It may also overwrite the same cell multiple times and others not, and it may use some of the spare cells it has.
In short, don't zero out flash drives or SSDs. It does not help with anything (not even for secure data erasure) and only wears the drive out more. If such a drive starts throwing I/O errors, replace it.
dd if=/dev/zero of=/dev/sdX bs=4M
(with /dev/sdX
being a device like /dev/sdb
, not a partition like /dev/sdb1
) operates directly on the raw disk, not respecting any partitioning. Zeroing a drive out with this command effectively wipes out the boot sector, partition table and all partitions equally. That said, it does not matter what you do before zeroing out the drive. You can partition it, format it, fill it with random data or whatever you like - in the end it will all be nuked. So just leave it and zero it out directly.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다