
As I indicated in my previous post my Beagle Bone is here. The Beaglebone team hase done a great job on the BeagleBone.
One of the first things I did was backup the Micro SD card. Here is how I did it on a Mac running Lion.
These commands should work in most version on Linux. Please note you will need at least as much disk space to store the SD Image as the size of the SD card. For example if the card is 4GB you need at least 4GB of free space on you computer to store the image. You can compress the images using tools like gunzip. After you use this tutorial as a learning tool feel free to modify it to your hearts content.
Please note this procedure involves block copies to devices. Pay careful atention to what device(s) you are coping from and to. Proceed at your own risk. I’m not responsible if you overwrite something you need.
Start with the Micro SD card removed from your Mac and open terminal.
Do a directory of the device directory using the following command:
$ ls /dev/disk*
/dev/disk0 /dev/disk0s1 /dev/disk0s2 /dev/disk0s3
In the example I only have one disk connected to my computer /dev/disk0. Ignore the devices like /dev/disk0s3. These are the same disk drive but a device entry for each partition on the disk. Note this existing disk and label it “existing volumes” on a piece of paper (Or if your green use your text editor of choice
. Documenting this disk is very important.
Now insert you beagle bone Micro SD card into a card reader. Now do the same command:
$ ls /dev/disk*
/dev/disk0 /dev/disk0s1 /dev/disk0s2 /dev/disk0s3 /dev/disk2 /dev/disk2s1 /dev/disk2s2
$
Ah look.. We now have a new disk drive /dev/disk2. This is your beagle bone SD Card. I say again Write this down on paper and label it “Beagle Bone”. Documenting this is very important.
Just a side note you should do this each time you connect the Micro SD card. If you use a different USB port of reader the disk device may change.
Now that the card is inserted most modern systems auto mount the drive. We want to unmount the volume before we make a copy of it.
$ ls /Volumes
BEAGLE_BONE Macintosh HD
$
Note the volume BEAGLE_BONE. This just might be our Beagle Bone volume! To unmount this volume on the mac use this command:
$ diskutil unmount /Volumes/BEAGLE_BONE/
Volume BEAGLE_BONE on disk2s1 unmounted
$
In Linux these command will differ slightly. First volumes are mounted to /mnt and the command you use is:
$ umount /mnt/BEAGLE_BONE .
Whew that was a lot of work and we haven’t started the copy!
OK now we can start the copy.
Remember the paper you wrote down the disks on? Take it out and look at it carefully. In our example /dev/disk2 is the Beagle Bone Micro Sd card.
Be sure to use the correct Beagle Bone device to copy to/from. Do not copy to or from any other existing disk(s).
Now we can copy the image to our computer. We use the program DD to do a copy of our exampe using disk2. Since we are using DD on the disk (i.e. /dev/disk2) not the partition (i.e. /dev/disk2s1) the DD program will copy all partition tables, formatting etc to the image. This is block by block copy of the drive. In our example we will call the output file beagle.img
sudo dd if=/dev/disk2 of=/users/nealzipper/Documents/beagle.img
Note the input file (if=) is our SD card. The output file (of=) is a file on our computer (/users/nealzipper/Documents/beagle.img ).
Now the frustrating part. DD does not indicate that is is doing anything. It is just happily copies from the Micro Sd card to to the disk quietly. This can take quite a while. In my case it was about 45 Minutes to complete so be patient.
Time passes ……
Now that the command prompt came back and you should have a file about the size of you SD card. You can confirm with
ls -al /users/nealzipper/Documents/beagle.img
-rw-r–r– 1 root nealzipper 3904897024 Jan 12 19:28 /users/nealzipper/Documents/beagle.img
Now the really really long part. We now will copy the image back to a new Micro SD card. This is the time you wished you bought the faster class 10 SD Card.
You may want to confirm the disk number as we did previously so you don’t write over the wrong disk (You haves been warned). This can take quite a while. In my case it was about 1.5 – 2 hours to complete so be patient.
sudo dd if=/users/nealzipper/Documents/beagle.img of=/dev/disk2
When you are done you have a bootable Image for you Beagle Bone.
I’d like to personally thank mongoose for his help and encouragement for me to peruse the embedded electronic space.
I hope this tutorial was helpful. If you have any suggestions please add a comment or email us using the contacts tab.
Enjoy, Neal