Cloning Beaglebone eMMC

Hello,

I’m trying to clone my beaglebone using : sudo dd if=/dev/mmcblk0 bs=1M | ssh machinekit@192.168.7.2 ‘dd of=/home/rimvis/Desktop/bbb.img bs=1M’
but everytime i get error ; dd: opening `/home/rimvis/Desktop/bbb.img’: No such file or directory. Any ideas how to solve it ?

Hello

it works for me… but you need to be careful about source and targets

from the BBB (source)
dd if=/dev/mmcblk0 bs=1M | ssh root@targetip ‘dd of=/target/directory/bbb.img bs=1M’

maybe try again ?

good luck

I guess if you are making a copy of the eMMC you have booted to the SD card and therefore eMMC should be mmcblk1 (or you have mmcblk0 in ro).
?

Hello,

I quite often have to clone a Beaglebone and dd is far too much time consuming for me. For that, I process that way:

  • make a reference installation on an eMMC (currently the single partition image from Robert Nelson)
  • use a separate SD card image and boot from this.
  • create a mount point on the SD card and mount eMMC to the mount point
  • tar cvfz archive.tgz -C

On the target system:

  • Boot from SD card

  • MLO and uImage are copied to eMMC from the ones on the SD card (this is a weak point but working for me)

  • fdisk eMMC for one partition and mkfs.ext4

  • mount eMMC partition and untar tgz to it.

  • !!! remove ssh keys and generate new ones !!!

  • !!! edit uuid of the eMMC partition in uEnv.txt !!!

I am starting this skript automatically after boot using a systemd process, when ready the board goes into powerdown. Whole flashing procedure takes about 2min. It is safe, if not working it can be re-done several times. Like to say from my experience that this is production grade.

That is done with a skript:

#!/bin/sh

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

precondition: make a tgz of an existing eMMC installation

boot from a SD card

mount the eMMC into a mounting point and then compress it with tar cvfz -C /

set -x -e

#umount mmc1
ntpdate -bv ptbtime2.ptb.de

export DISK=/dev/mmcblk1
dd if=/dev/zero of=${DISK} bs=1M count=10
dd if=/opt/backup/uboot/MLO of=${DISK} count=1 seek=1 conv=notrunc bs=128k
dd if=/opt/backup/uboot/u-boot.img of=${DISK} count=2 seek=1 conv=notrunc bs=384k

sudo sfdisk --in-order --Linux --unit M ${DISK} <<-EOF
1,0x83,*
EOF

mkfs.ext4 ${DISK}p1 -L rootfs

sync

mount ${DISK}p1 mmc1

tar xfm <previouly_archived_root_file_system> -C mmc1

BLKID=blkid -o export /dev/mmcblk1p1 | grep -i uuid
UUID=$(echo $BLKID | tr ‘[:upper:]’ ‘[:lower:]’)
sed -i “s/uuid=.*/$UUID/I” mmc1/boot/uEnv.txt

rm -fv mmc1/etc/ssh/key
ssh-keygen -t dsa -b 1024 -f mmc1/etc/ssh/ssh_host_dsa_key -q -N “”
ssh-keygen -t rsa -b 1024 -f mmc1/etc/ssh/ssh_host_rsa_key -q -N “”
ssh-keygen -t ecdsa -b 256 -f mmc1/etc/ssh/ssh_host_ecdsa_key -q -N “”

umount mmc1
poweroff