Duplicate BeagleBone black setup

Hi,
I have a BeagleBone black Rev. A5C with a running Debian Wheezy configured as MPD server (works like a charm).
Now I would like to duplicate the whole setup to another BeagleBone black - this time a new Rev. C.

I found this in Stack exchange:
https://stackoverflow.com/questions/17834561/duplicating-identical-beaglebone-black-setups
The first answer seems feasible - hower I do not know if this works with different source and target - revisions

If I got it right the eMMC size is differenz between the revisions. Does that effect the mentioned solution in any way?

TIA!
roland

Interesting point to clone a Rev. A board to a Rev. C board.
May be you should change the subject to → Duplicate/Clone BeagleBone black Rev.A to Rev.C

Billy

Cloning a smaller image to a larger disk is where tr would come in handy.

http://www.aboutdebian.com/tar-backup.htm

Of course the user needs to take care of partition(s) manually but in my own opinion is much simpler than running an alternative backup method and waiting hours for each step to complete.

“tr” should be tar.

Just in case somebody finds it useful:

The duplication has worked now!
I did it according to first stack overflow answer and the reference here:
http://elinux.org/BeagleBone_Black_Extracting_eMMC_contents

The preparation of the microSD card can only be done under a Linux environment - at least I did not manage to prepare it under Windows.
The root file system was now 2GB in size - although the Rev C has 4 GB.
Resizing was done exactly like in
http://blog.asiantuntijakaveri.fi/2014/05/flashing-beaglebone-black-rev-b-2gb.html

----"
What you want to do next is resize root partition to fill entire eMMC, otherwise you’re leaving few hunded megabytes of capacity unused and rev B internal 2GB eMMC is already a bit on small side for full blown Linux install. Below steps will of course work for SD card rootfs as well.

Switch to root

sudo su -

Delete and recreate root partition using entire disk

internal eMMC is called mmcblk0 now as we don’t have any SD cards connected

fdisk /dev/mmcblk0

Delete partition #2 (type “d” and then “2”)

Create new partition (type “n” and hit enter four times to accept defaults)

Write changes (type “w”)

Reboot so new partition table gets read

reboot

Login again as root and resize root fs

resize2fs /dev/mmcblk0p2

"—

Works like a charm!

Hi,

I do find it useful, as I have problem to do it myself.
Questions:

  1. what is the format of SD card? FAT16 - (can be max 4GB) or FAT32? I am using Gparted on VM Ubuntu, what are the flags - I set vboot and lba
  2. do you need to hold the S2 button while powering BBB as described here https://stackoverflow.com/questions/17834561/duplicating-identical-beaglebone-black-setups
    or not as described here http://elinux.org/BeagleBone_Black_Extracting_eMMC_contents
  3. is there a sequense you need to copy extracted files into SD card or doesn’t matter?

So far nothing works for me.
Can you share your way?

Jan

1) what is the format of SD card? FAT16 - (can be max 4GB) or FAT32? I am using Gparted on VM Ubuntu, what are the flags - I set vboot and lba

https://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-SetupmicroSD/SDcard

  1. do you need to hold the S2 button while powering BBB as described here …

If uEnv.txt contains uenvcmd as below**,** you should not have to press S2 during bootup.

uenvcmd=run boot_ftd; run netargs; bootz 0x80200000 - 0x815f0000

However do note the below example is a netboot example so do not use this. Instead use something similar to this:

https://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-DealingwitholdBootloaderineMMC

  1. is there a sequense you need to copy extracted files into SD card or doesn’t matter?

Yes and no. Files, etc need to be in certain locations, that is about it. You will note going by Roberts instructions linked twice above, there is a hole in the first part of the single partition to fit the bootloader files, and then sfdisk takes up the rest of the available disk space for the EXT4 rootfs. If these instructions on this page are unclear feel free to either google “man page sfdisk” Or install sfdisk on your VM’s ubuntu and read the man pages for sfdisk. etc.

Important notes.

Your rootfs must contain modules for the specific kernel you’re planning on using. That is, if you plan on using any. If you’re using an existing working sdcard image. this should not be much of a problem.

Duplicating the partition structure can be done using dd, if the duplicate disk is the same size, or larger. However, for larger disks, it is much simpler to use tar

ddhttp://www.debianhelp.co.uk/ddcommand.htm

tarhttp://www.aboutdebian.com/tar-backup.htm

I was able to save the contents of eMMC as an *.img following this link http://elinux.org/BeagleBone_Black_Extracting_eMMC_contents ,
into 4GB FAT32 uSD card, no button pressing. After that I modified autorun.sh as per instruction from the same side.
The restore on the same board doesn’t hapen, however. Any hints?
Jan

Jan:

I also had problems restoring and copying a BBB image for the Rev.C (4 GB eMMC) and
the new larger Debian distributions, particularly if you have added additional code and
updates to the distribution for your application.

I suspect that the existing instructions/methods assume smaller code and memory sizes.

I have been successful duplicating a Debian 8 (jessie) that has had upgrades
and my application code added to it on a Rev.C BBB.

1.) Use a uSD card larger than 4 GB. You will need something larger than 4 GB to
save a 4 GB image using dd. I used 16 GB, but you can not go larger than
32 GB at this time.

2.) Install one of the Debian distributions on the uSD card. I chose
bone-debian-7.7-console-armhf-2014-11-19-2gb.img

3.) If you examine the installation, it is using less than 2 GB of the card.
Use Gparted to expand the partition size to the full size of the card. In my case,
16 GB, which gives me room on the card to hold multiple 4 GB “.img” files.

4.) Plug the uSD card into the BBB for which you want to copy the eMMC and
apply power. The console distribution I chose boots straight onto the uSD
card, without pressing the S2 button. If you use some other distribution,
things may work differently.

5.) Sign in as ‘root’ and enter
dd if=/dev/mmcblk1 of=/mnt/BeagleBoneBlack-eMMC-image-$RANDOM.img bs=10M

6.) Wait 9 minutes for the command to return to the command line. It takes about
2 minutes per GB to build the “.img” file. type sync. The completed file will be located
at /mnt/ The “.img” file will be slightly less than 4 GB in size

7.) Shutdown this BBB, and plug the uSD card in the target BBB.

8.) Power up the target BBB and sign in as root, and type on the command line
dd if=/mnt/BeagleBoneBlack-eMMC-image-NUMBER.img of=/dev/mmcblk1 bs=10M
where NUMBER is the random number of the img that was generated in step (5).

9.) Wait 9 minutes for the command to return, sync, shutdown, remote uSD card
and re-power the target. The target should now be a duplicate.

Other thoughts:
You can compress the “img” file on the BBB by
xz BeagleBoneBlack-eMMC-image-NUMBER.img
BUT it will take 2 Hours on the BBB to compress a 4 GB file, when booted on an uSD card.
You are much better off moving the file to an external machine to compress it.

You can do a SSH copy of the “img” file to an external (Linux) machine via
the Ethernet connection by doing something like:
scp root@192.168.1.200:/mnt/BeagleBoneBlack-eMMC-image-NUMBER.img /home/your-name/Images/
It will transfer at around 8 MB per second, if the BBB is otherwise idle.

— Graham

And one additional thing:

3a.) While you are inside Gparted, expanding the partition size, make sure
that the ‘boot’ bit is set for the partition, otherwise the BBB can not automatically

boot from the card.

— Graham

Graham,

You saved me a lot of time and frustration. Thank you, much appreciate it.
My teacher at uni used to quote Alber Einstein - “If you can’t explain it to a six year old, you don’t understand it yourself.”
Your comprehensive instruction is easy and logical.
I am getting a new uSD cards for that exercise and I had a feeling I should be fine from here.
In a meantime, I have a an SD card console image, that you recommended and as a surprise it has to SSH on USB.
I put a FTDI cable and I see it is booting and outputs to the serial console.
Can I easily add the SSH over USB to that image and if yes, how?

Thank again

Jan

“If you can’t explain it to a six year old, you don’t understand it yourself.”

Or maybe they just feel that the people who need the instruction should invest a little of their own time. e.g. YOU should spend some time learning the environment you’re attempting to use. Because a six year old quite honestly could figure out how to do this with all the information thats been provided.

Jan:

SSH secure copy is part of the core Linux toolbox, and should be part of any of

the Debian distributions for the BBB. And it will work in both directions,

so you can also push an “.img” (or any file) from the remote Linux computer
back to the BBB.

Telnet access to the command line via SSH is also part of the toolbox.

— Graham