Daan Koning
Daan Koning

Reputation: 165

How to initialize USB in Bash

So I'm trying to create a bootable USB to help out in tech support for some friends. I decide to got with Puppy Linux as some of my family members don't have such powerful machines.

I buy a flash drive only to be met by this error once I insert it. The disk you inserted was not readable by this computer.

All dandy I can probably fix this. I open up Disk Utility; navigate to the drive and try to run first aid hoping to get it up and running in no time. And, boom error:

Fixing damaged partition map.

The operation couldn’t be completed. (com.apple.DiskManagement error -69874.)

Operation failed…

Ok, a usable error I can google. Boy was I wrong, I found a whole load of nothing. So I do some digging in the terminal docs and come up with this command: diskutil eraseVolume ExFAT MyName disk3. which returns another error:

Started erase on disk3
Unmounting disk
Error: -69888: Couldn't unmount disk

which lead me here. Is my drive halve DOA or is there some simple fix?

Upvotes: -1

Views: 1048

Answers (1)

nbari
nbari

Reputation: 26985

Looks like you are using macOS, in this case, I would suggest using etcher.io since the process is pretty easy and straightforward.

In case you would like to do it from the terminal and already have the image, you could do something like this:

Firs find your USB try this command:

$ diskutil list

Lest assume is /dev/disk3, then try to unmount it

$ diskutil unmountDisk /dev/disk3

Now use the dd command, keep in mint it will destroy any existing data on the target disk:

$ sudo dd bs=1m if=latest-USB.img of=/dev/rdisk3

Notice the r - raw in of /dev/rdisk3

Upvotes: 0

Related Questions