Hi all. I did sudo dd if=/dev/zero of=/dev/sdg bs=1M to wipe an external drive and now it seems broken. Cannot create partition table, get input/output errors. Did I do anything wrong? Can I do anything to fix it?
gparted has been able to reformat thumb drives for me when I've loaded them with dd.
gparted does occasionally show the disk, but fails to create partition table.
man cfdisk snippet:
COMMANDS cfdisk commands can be entered by pressing the desired key (pressing Enter after the command is not necessary). Here is a list of the available commands: ... W Write partition table to disk (must enter an upper case W). Since this might destroy data on the disk, you must either con‐ firm or deny the write by entering `yes' or `no'. If you enter `yes', cfdisk will write the partition table to disk and the tell the kernel to re-read the partition table from the disk. The re-reading of the partition table does not work in some cases, for example for device-mapper devices. In particular case you need to inform kernel about new partitions by part‐ probe(8), kpartx(8) or reboot the system.
...might help you get out of this jam with a working hard drive...
Thanks guys. Still no luck.
I enter "sudo cfdisk /dev/sdb" and get:
fatal error: cannot read disk drive
press any key to exit cfdisk
If started with no disk specified "sudo cfdisk", it only shows my other drives. Not the damaged one.
Last edited by audune (2013-07-04 21:01:53)
Note: I understand the next question will sound like "Help Desk 101". I'm just trying to be thorough.
Have all the previous attempts been done without disconnecting the USB drive? If so, you might want to try unplugging it, and maybe even rebooting the system.
Last edited by audune (2013-07-05 06:02:39)
audune; Are you starting gparted as "sudo" ?
Try to create a valid MBR on the disk using syslinux
1. Install package syslinux
sudo apt-get install syslinux
This installs a valid mbr image in file /usr/lib/syslinux/mbr.bin
2. now use dd to copy that bin image to the disk
sudo dd if=/usr/lib/syslinux/mbr.bin /dev/sdx
WARNING: Replace sdx with the correct device name.
3. now run gparted on the disk.
Last edited by xaos52 (2013-07-05 10:04:21)
You gave me hope xaos52. Unfortunately I get this:
sudo dd if=/usr/lib/syslinux/mbr.bin of=/dev/sdb
dd: writing `/dev/sdb': Input/output error
0+1 records in
0+0 records out
0 bytes (0 B) copied, 0.0402689 s, 0.0 kB/s
Will try some more...
Post output of
please, preferably after a reboot and with the external disk plugged in.
Have you tried on another USB port?
If you experience the same problem, try this in a terminal window
sudo badblocks -wvs /dev/sdX
While that is running, open another terminal window and watch your logfile
run sudo tail -f /var/log/syslog
Check for loops - if it repeats the same sector over and over again, then the error is irrecoverable.
Warning: running badblocks on a 1 TB USB HD can take a long time. Say 24 hours at least.
Thanks guys. At least I'm learning something from this. I cannot run gsmartcontrol, I get : GLib-CRITICAL **: g_str_has_prefix: assertion `str != NULL' failed
Does that just mean that i can't find the program? Will now try badblock scan overnight.
I did wipe a harddisk some years ago with a tool from UBCD or Hirens boot cd or something. Cannot rememger the name of the program, But it also killed my disk. Is wiping a risky task? Is the dd method a good one? Seems to be reccommended by many which is why I chose it. From now on I will encrypt the drives from start so I don't have to wipe them.
Here is what I do to swipe a disk:
1. wipe the filesystem(s) with
sudo mkfs.ext4 /dev/sdxn
replace x by the drive name.
replace n by the partition number. repeat for every partition on the device.
2. create a file with random data in your current dir using dd
dd if=/dev/random of=./random.data count=500 bs=1M
3. fill every partition on the disk with this script:
mkdir -p /media/sdxn mount /dev/sdxn /media/sdxn for n in 1..10000; do cp ./random.data /media/sdxn/$n done
run the script as root for each partition on the device.
4. repeat 1 to clear the disk space.
Result: empty disk with random data without touching the mbr. use gparted to repartition.
PS: I wrote this from the top of my head - does one say that in English? - so it may need some minor corrections.
gsmartcontrol works for my system - waldorf upgraded to sid.
Will check if it works on a fresh waldorf install.
Thanks for the tip!
I got gsmartcontrol working, but it says my drive is not supported. Still running "badblocks", apparently without loops so far.