-
Notifications
You must be signed in to change notification settings - Fork 0
Use 'dd' to reimage flash memory storage devices on Mac OS X
Before inserting the flash memory storage device, run the following command:
$ df -h
After inserting the flash memory storage device, run the same command. The new item(s) shown in the list is/are associated with flash memory storage device. Usually the device will be something like: /dev/disk3.
We want the storage device to be unmount, but not ejected. We will use the following command to accomplish this:
$ diskutil unmount /dev/disk#s#
While the physical device is /dev/disk#, usually the partition(s) will be /dev/disk#s#. It may be necessary to run this command more than once if the device has more than one partition mounted.
We will (most likely) need to prepend 'sudo' to the command so we will have permission to perform the operation. Use the same device (without the partition identifier) that you found associated with the storage device in Step 1. Warning - If you get the destination device wrong, you could destroy the contents of another storage device.
$ sudo dd bs=1m if=source_image_file of=/dev/disk#
This is an extra step, but it helps ensure that the reimage is complete
$ sync
After the reimaging is complete, OS X will (most likely) mount the storage device. I like using the following command to Unmount it.
$ diskutil unmount /dev/disk#s#
You should now be able to remove the storage device safely.