How to zero out a drive?
Zero-out drive on Linux is done via:
dd if=/dev/zero of=/dev/sdX
where sdX
is the device of the drive to delete.
If you're not aware on how to do this, press Ctrl+Alt+T from Ubuntu, and type following:
sudo dd if=/dev/zero of=/dev/sdb
In example above, sdb
is the second connected drive.
NB! This will erase your drive completely. Use at your own risk.
EDIT 1:
Optionally, you might want to add status=progress
to show progress status:
sudo dd if=/dev/zero of=/dev/sdb status=progress
EDIT 2:
As per comments below, setting the buffer size might significantly speed up the process:
sudo dd if=/dev/zero of=/dev/sdb bs=16M
Please note, however, with a buffer dd
will not wait until operation is complete, so afterwards you might need to execute sync
command, which synchronizes data on disk with memory.
sudo dd if=/dev/zero of=/dev/sdb bs=16M && sync
What's the purpose of sync
? Simple: in case if your storage is slow and power off happens right after dd
while disk data is not synchronized, some of the data might be lost. It might be not so relevant for this particular case about zeroing out the drive on PC, but for things like embedded systems with slow flash memories this needs to be considered.
Maybe I can add a little insight here. When booting with a Windows CD, the Windows installer program is kind of stupid and worthless as most Microsoft products are. What can end up happening is the operating system of the Windows installer CD will hand and die. Mostly because it doesn't know what to do with a hard drive that is not zero'd, or doesn't have Windows. It doesn't give an error, just hangs.
I happen to have a perfect example right in front of me right now. Even when I boot with an Ubuntu CD, on this ASUS computer, the OS, begins to start, then it touches the hard drive, as any good OS should do, in order to see what resources are present.
On this particular computer, (and the problem is with the BIOS of the particular machine) it appears to hang, for almost 20 minutes, for each touch of the hard drive. So booting a live CD on this computer can take almost 20 minutes. Just in case, I'd check for a BIOS upgrade on your system, it will prolly fix the USB booting issues and maybe the timeout routine for no hard drive access, although that's more unlikely.
If you can boot from the live CD, just let it sit. Shouldn't take more than an hour, if you have the same booting flaw as this machine. Once it comes up, do the HD zero out, in a pinch though, boot with your Ubuntu on HD, and zero it out anyhow. It should zero out enough before the OS crashes to allow your worthless Windows install CD to work.