Clone SD CARD (/dev/mmcblk1) to eMMC DISK (/dev/mmcblk0)
Cloning abootable SD card to an eMMC device on Ubuntu (typical on SBCs like Raspberry Pi*, ODROID, Orange Pi) is straightforward: identify the right devices, unmount them, clone disk-to-disk with dd, then expand the root partition and filesystem on the destination. The result is an exact, bootable replica—including the bootloader area, partition table, and all filesystems.
Dan Ger .ing
Reversing if= and of= will destroy your source. Double‑check device names before running dd.
Identify disks and partitions
Use lsblk to see devices, sizes, and mounts.
lsblk -o NAME,MAJ:MIN,RM,SIZE,RO,TYPE,MOUNTPOINTS
Example (abridged):
mmcblk0 179:0 0 233G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part
└─mmcblk0p2 179:2 0 232.7G 0 part
mmcblk1 179:96 0 29.5G 0 disk
├─mmcblk1p1 179:97 0 4M 0 part
└─mmcblk1p2 179:98 0 29.5G 0 part /
Confirm which is source (SD) and destination (eMMC) by size and mounts.
Unmount source + destination
dd does a block‑level clone; nothing should be mounted from either disk.
sudo umount /dev/mmcblk1*
sudo umount /dev/mmcblk0*
If a partition is busy, close terminals/file managers using it, or use
lsof | grep mmcblkto find blockers.
Clone source → destination
dd will copie every sector from SD to eMMC, including bootloader areas.
# Clone the entire SD card to the eMMC
echo "About to clone: if=/dev/mmcblk1 → of=/dev/mmcblk0" && read -p "Press Enter to continue or Ctrl+C to abort..." _
sudo dd if=/dev/mmcblk1 of=/dev/mmcblk0 bs=4M status=progress conv=fsync
# Optional: ensure caches are flushed
sync
Sample progress output:
20145242112 bytes (20 GB, 19 GiB) copied, 289 s, 69.7 MB/s
Reboot
When dd finishes, the eMMC is a bit‑for‑bit clone of the SD card and should be bootable.
Expand the root partition to fill the eMMC
If the eMMC is larger than the SD, the cloned root partition will match the old size. Grow it to use the full device.
We’ll assume a simple two‑partition layout:
mmcblk0p1— boot (small FAT partition)mmcblk0p2— root (ext4)
Resize the partition with parted
sudo parted /dev/mmcblk0
(parted) print
# Verify partition numbers and end of disk
# Resize the root partition (usually #2) to 100% of remaining space
(parted) resizepart 2 100%
(parted) quit
# Ask the kernel to re-read the partition table
sudo partprobe /dev/mmcblk0 || true
If your layout differs, adjust the partition number accordingly. For more options, see the
partedman page.
Grow the filesystem (ext4)
# Expand the ext4 filesystem to fill the enlarged partition
sudo resize2fs /dev/mmcblk0p2
Validate the result:
lsblk -o NAME,SIZE,TYPE,MOUNTPOINTS /dev/mmcblk0
Reboot from eMMC
- Shut down the SBC.
- Remove the SD card.
- Power on and boot from eMMC.
Post‑boot, confirm root is on eMMC:
lsblk -o NAME,SIZE,TYPE,MOUNTPOINTS
# Root (/) should now be on /dev/mmcblk0p2
Notes & tips
- If you prefer a friendlier UI for resizing,
gpartedworks well (run from the SD before booting from eMMC). - For flaky SD cards, consider
ddrescueinstead ofddfor better error handling. - Some boards place bootloader code outside partitions; cloning the entire device (not just partitions) preserves this.
Quick reference (copy/paste)
# Identify
lsblk -o NAME,SIZE,TYPE,MOUNTPOINTS
# Unmount
echo Unmounting...
sudo umount /dev/mmcblk1* || true
sudo umount /dev/mmcblk0* || true
# Clone (SD → eMMC)
echo "Cloning if=/dev/mmcblk1 to of=/dev/mmcblk0" && read -p "Enter to proceed..." _
sudo dd if=/dev/mmcblk1 of=/dev/mmcblk0 bs=4M status=progress conv=fsync
sync
# Resize partition (root is p2 here)
sudo parted /dev/mmcblk0 --script print
sudo parted /dev/mmcblk0 --script resizepart 2 100%
sudo partprobe /dev/mmcblk0 || true
# Grow filesystem (ext4)
sudo resize2fs /dev/mmcblk0p2
# Reboot, remove SD, boot from eMMC
—
Raspberry Pi typically boots from SD; some models/bootloaders require additional steps to fully enable eMMC boot. Consult your board vendor docs if the clone doesn’t boot first try.