Imaging an SD card for PlugPBX (Mac OS X GUI)
- Insert a SD Card reader with your choice of ‘destination’ SD flash card. You should notice it show up on the desktop if formatted FAT or something similar. Make at note of its volume name on the desktop. If you’ve flashed the card with a Linux filesystem before, ignore the macs prompts to format it (do not!) and continue.
- Download and install the Following software at http://www.gingerbeardman.com/dd-gui/ – When executed you’ll see the following window appear..
- Click on the “Devices” Button to have a list of all disk devices. Ensure the device matches the storage capacity of the SD card to ensure you do not image to the incorrect disk, which could cause data loss. Don’t make a typo!
- In the case of writing an SD card, your SOURCE will be the image file and DESTINATION will be the /dev/disk device
- Click on the Start Button and the following progress window will open
- This is the dd command running with pv inserted into the pipe to show you data rate, and progress as well as an estimated time to completion. You can use the tool in reverse to also backup/image an SD card image too
Imaging an SD card for PlugPBX (Mac OS X Command Line)
- Insert a SD Card reader with your choice of ‘destination’ SD flash card. You should notice it show up on the desktop if formatted FAT or something similar. Make at note of its volume name on the desktop. In our example its “Untitled”
- Open the Terminal.App” and type the following command: mount …and then press enter.
- Search the output and look for your Disk/Device correlation. In this example tonight I got back the following…
/dev/disk1s1 on /Volumes/Untitled (msdos, local, nodev, nosuid, noowners)
- So we know that this is /dev/disk1 and that s1 is our main partition. We want to image the raw disk so we only care about /dev/disk1
- So now if wish to ‘write’ a downloaded PlugPBX image to this disk we first unmount it a special way such that we still have access to the raw disk but not any mounted volumes using the diskutil command. Using the above command I’ll do the following:
diskutil unmount disk1s1
- Provided no windows / files were open, the disk will be unmounted. You can check now with the mount command once more.
- Finally we take a page out of unix since Mac OS X is unix more or less, and use the dd command. This example will take a disk image and render it to the raw SD card image.
sudo dd if=/Users/abcdefg/PlugPBX/betaimageDec16.img of=/dev/disk1
TAKE CARE as if you point to the wrong disk, you can dammage your system. BE mighty sure you image the RIGHT disk / device!!!
- sudo is a unix command to elevate my privileges to root (full access) as Mac OS X has this off by default. I’m not sure if its needed or not but habit is habit. DD dos many things, in this case it will take the raw data in the .img file and dump it bit for bit to the raw disk device, not caring or knowing about file systems or anything else. I used dd to extract from the PlugPBX master SD card I create and test and render them a file just reversing the parameters. Very slick!
Note: This process will take awhile. Be Patient. When DD is done processing its stream it will exit and give a summary of total data transferred. See here for more details on using dd on OS X. As you can see below, this image of 4 gigs onto a 4 gig class 6 SDHC card took quite awhile. We’re going to be shrinking down the size of PlugPBX soon once we get things well tested, as we’ll no longer ship it with Development and Source code to cut its size down considerably!
dd: /dev/disk1: end of device 7839745+0 records in 7839744+0 records out 4013948928 bytes transferred in 7434.024208 secs (539943 bytes/sec)
There are plenty of examples online using ‘dd’ – search Google for more details on this tool.