Wiping entire usb drive on Mac OS X

冷暖自知 提交于 2020-05-29 07:37:32

问题


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:


回答1:


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



回答2:


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



来源:https://stackoverflow.com/questions/43614352/wiping-entire-usb-drive-on-mac-os-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!