Cloning a BBB with 4gb to a BBB with 2gb?

Can I clone the eMMC’s content of a BBB with 4gb to a BBB with 2gb? The 4gb BBB uses less then 2gb.

I’ve done a backup from the 4gb BBB with
`

dd if=/dev/mmcblk0 of=/media/sda1/sd_backup.img

`

Juergen

Give this a try on your Linux Desktop:

copy sd_backup.img to your Desktop’s /tmp

Insert your SD card, I’m assuming it will be /dev/sdb

mkdir -p /mnt/from_part1
mkdir -p /mnt/to_part1

fdisk -l /tmp/sd_backup.img

Disk sd_backup.img: 4025 MB, 4025483264 bytes
255 heads, 63 sectors/track, 489 cylinders, total 7862272 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
sd_backup.img1 * 2048 43007 20480 83 Linux

echo “2048 * 512” | bc
1048576

mount -o loop,owner,offset=1048576 /tmp/sd_backup.img /mnt/from_part1

mount /dev/sdb1 /mnt/to_part1

cd /mnt/from_part1/
tar -cf - . | ( cd /mnt/to_part1; tar -xpvf - )

sync
umount /mnt/from_part1
umount /mnt/to_part1