Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wiping entire usb drive on Mac OS X

Is there a command for the apple terminal to brute force a wipe of everything including all partitions, master boot records, and data on a usb flash drive?

Just a little information about the situation:
I just got a stick from a friend which seems to be damaged but it isnt a physical defect. I guess he just removed the stick while formatting or so.

I already tried to repartition, reformat and erase the stick with the Mac Disc Utility and I tried to format it on windows. Nothing of it worked, so I decided to use terminal for it (im just getting used to terminal/bash, so im a complete newbie at this) and tried the commands (all with sudo and diskutil in front of them ofc) repairDisk, reformat, partitionDisk, eraseDisk or zeroDisk, but nothing worked. Im getting this error message now: Error: -69759: Securely erasing data to prevent recovery failed Underlying error: 5: POSIX reports: Input/output error

So my final thought is now that I have to clean everything from this drive as it seems there is something broken on a very low level and i would assume that completely wiping it will result in my diskutil to install a complete new partition scheme and everything on the drive so it will eventually start working again..

Thank you all in advance!

Screenshots: dd attempt and disk info

like image 577
M. Hoffmann Avatar asked Sep 01 '25 22:09

M. Hoffmann


2 Answers

Try this in Terminal if you are CERTAIN it is disk3:

sudo dd if=/dev/zero of=/dev/rdisk3 bs=65536 count=1000

If it says the disk is busy, make it un-busy!

sudo diskutil unmountDisk /dev/disk3
like image 115
Mark Setchell Avatar answered Sep 03 '25 13:09

Mark Setchell


First, check what disk# your usb is (to be certain) in a terminal:

sudo diskUtil list

then

sudo dd if=/dev/urandom of=/dev/<your_usb_disk_here> bs=1m

If you get busy error and/or if the usb is in use elsewhere, stop what you are doing there and unmount it first as Mark Setchell said

sudo diskutil unmountDisk /dev/<your_usb_disk_here>

If you get a funky name from using bootcamp assistant or something, and you cannot get dd or even Disk Utility to wipe it for some reason, like "permission" problem, use:

diskutil eraseVolume HFS+ NAME <your_usb_disk_here>

Note that the last arg is not e.g. /dev/disk2 , but just the last part, disk2

like image 20
Droid Teahouse Avatar answered Sep 03 '25 13:09

Droid Teahouse