Jump to content

Clone eMMC to MicroSD


Erario

Recommended Posts

I couldn't find anything on the web, I looked everywhere.
With the dd command I can of course create a complete image of the eMMC anywhere, even on a network path, but I can't find anything that allows me to do what the "nand-sata-install.sh" script does, which formats the eMMC and populates it with all the contents of the MicroSD, appropriately adapting some files needed for booting.
It would be many useful to be able to do the exact opposite as well, i.e. clone eMMC to MicroSD, which would be useful to have a bootable backup with all the customizations performed on the eMMC, without having to go through the process of creating an image file.
I tried modifying the script to do this but could not do it, there is actually an option already there to do this but it doesn't work for me.
Surely there is someone better than me, I hope, who maybe has already done this.

nand-sata-install.sh

Edited by Erario
Link to comment
Share on other sites

Since you are posting in the TV Box sub-forum, I'm assuming you are talking about a TV Box.  But you have't provided any informaion about your setup.  What TV Box do you have, what version of Armbian do you have (by version I mean the name of the image you downloaded, and where downloaded from).

Link to comment
Share on other sites

Another excellent method that works perfectly is this.
The advantage of this script is that it succeeds in copying the entire filesystem to SD or USB drives without performing a mirror clone as with dd, so even if the destination is smaller than the source as long as it has the space needed for the actual space occupied.
I had been using it for years on RPI, I didn't think it was compatible with Armbian as well, instead it works great.
And by taking the correct version from here is already compatible with Armbian, also acts on correcting UUID on the target device to make it boot correctly after the clone.
If it works on my tvbox it will also work on any official Armbian distribution, so on any device... absolutely must have! :P

 

Booted disk: mmcblk2 63.7GB                Destination disk: mmcblk0 31.4GB
---------------------------------------------------------------------------
Part     Size    FS    Label           Part   Size    FS    Label
1 root    58.7G  ext4  --              1       29.3G  ext4  --
---------------------------------------------------------------------------
== Initialize: IMAGE partition table - forced by option ==
1 root                (6.7G used)    : RESIZE  MKFS  SYNC to mmcblk0p1
---------------------------------------------------------------------------
-e clone fstab edit    : edit mmcblk2p device entries to mmcblk0p.
Run setup script       : no.
Verbose mode           : no.
-----------------------:
** WARNING **          : All destination disk mmcblk0 data will be overwritten!
-----------------------:

Initialize and clone to the destination disk mmcblk0?  (yes/no): y
Optional destination ext type file system label (16 chars max):

Initializing
  Imaging past partition 1 start.
  => dd if=/dev/mmcblk2 of=/dev/mmcblk0 bs=1M count=8 ...
  Resizing destination disk last partition ...
    Resize success.
  Changing destination Disk ID ...
  => mkfs -t ext4  /dev/mmcblk0p1 ...

Syncing file systems (can take a long time)
Syncing mounted partitions:
  Mounting /dev/mmcblk0p1 on /mnt/clone
  => rsync // /mnt/clone with-root-excludes ...

     Editing /boot/armbianEnv.txt UUID to use 08477615-e9ee-4faa-8574-d58796f838ad for partition 1
     Editing /etc/fstab UUID to use 08477615-e9ee-4faa-8574-d58796f838ad for partition 1
===============================
Done with clone to /dev/mmcblk0
   Start - 14:56:29    End - 14:57:55    Elapsed Time - 1:26

 

Edited by Erario
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines