Overwriting the whole disk with zeroes (bad sectors)

Generoso

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:

  • Is the block size value correct or should I set a different value depending if the disk is internal or external?
  • Is there another command in case of a pen drive or a SSD drive?
  • After I've deleted all partitions and created a new partition table by Gparted, should I also create a new partition (e.g. ext4) before typing the above command?

Thank you! :)

Byte Commander
  • 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] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How can I do disk surface scanning, and fix/reallocate bad sectors in Linux from the command line?

분류에서Dev

AutoMapper - Why it is overwriting whole object?

분류에서Dev

How to use badblocks to scan a certain /dev/sdX to deal with bad sectors

분류에서Dev

What happens to sectors marked as bad when HDD is repartitioned?

분류에서Dev

reference whole disk (/dev/sda) using UUID

분류에서Dev

Linux: Resize disk without updating GPT: gdisk says new sectors not usable

분류에서Dev

How possible a hard drive that used to have bad sectors now have none?

분류에서Dev

Is it Bad to fill up my whole C drive (Windows installed drive)

분류에서Dev

ext4 : bad block fixed, but is this disk dying?

분류에서Dev

Strip zeroes with regex in csv file

분류에서Dev

Nested IFs to pad numbers with zeroes

분류에서Dev

SQL overwriting data

분류에서Dev

Overwriting a Static Const Variable

분류에서Dev

Adobe Analytics overwriting visitorID

분류에서Dev

Matching fixed number of zeroes before new line

분류에서Dev

ARP messages padding with zeroes.. sometimes

분류에서Dev

Where does my leading zeroes go?

분류에서Dev

Disk Utility not finding disk

분류에서Dev

replace a string in the file is overwriting everything

분류에서Dev

Yii url rules overwriting eachother

분류에서Dev

Java - BufferedWriter overwriting lines issue

분류에서Dev

Meteor Shell overwriting previous input

분류에서Dev

alignment on disk

분류에서Dev

gnome/nvidia overwriting .nvidia-settings.rc

분류에서Dev

(Overwriting?) Issue With Pushing Search Results To Array

분류에서Dev

Overwriting line in unix shell after printing

분류에서Dev

Laravel routes overwriting phpmyadmin path with nginx

분류에서Dev

how to render the whole page?

분류에서Dev

Hashutils to recurse the whole drive

Related 관련 기사

뜨겁다태그

보관