How do I make a copy of my BBB SD card?

I am using Debian on my BBB. I would like to make a copy of my SD card. What is the process to replicate my SD card? Your help will be greatly appreciated.

Thanks,

Lidia

On Fri, 28 Oct 2016 16:04:50 -0700 (PDT), Lidia Toscano
<lidia.toscano@gmail.com> declaimed the
following:

I am using Debian on my BBB. I would like to make a copy of my SD card.
What is the process to replicate my SD card? Your help will be greatly
appreciated.

  Well... How did you create the SD card in the first place? The BBB
doesn't ship with one, since the core OS is in the on-board eMMC, so you
had to have obtained an OS image and written it to a blank SD card.

  For my units, that meant using Win32DiskImager to write the downloaded
image to the card (followed by booting the card and expanding the partition
from the image's 4GB to use the entire 8GB card).

  Win32DiskImager can also create an image file FROM an SD card. That
image could then be written to another card of the same size or larger. (If
I were to read my expanded 8GB card, it would create an 8GB image which
won't fit on a 4GB card).

Yes but it is not just the image I originally burned onto the SD card, since then I’ve uploaded and configured a bunch of files. I just wondered if there was a way to duplicate the SD card with everything I’ve loaded and configured on it without having to try to re-invent the wheel. It seems there ought to be a way. For some reason, I don’t think just dragging and dropping all of the files from one SD card to another would do the trick, or would it?

Thanks,

Lidia

On Sat, 29 Oct 2016 11:48:55 -0400, Lidia Toscano
<lidia.toscano@gmail.com> declaimed the
following:

Yes but it is not just the image I originally burned onto the SD card,

  My question was "what did you use to create the original SD card".

  I then went on to explain that the software /I/ used can create an
image file FROM and SD card, which could then be used to write a copy to a
different SD card. (I just got done doing that yesterday, for my RPI3 --
I'd made a backup a few weeks ago since I was running a benchmark suite
that required a swap file on the card, and thrashed it heavily... when I
booted the RPI3 yesterday, fsck found a massively trashed disk structure --
I think it was reading the former swap file as directory entries: multiply
claimed inodes, for everything on the disk -- I finally pulled the plug,
verified my backup would boot [it did], shutdown, made an image from that
card, formatted the original card, and wrote the image to it)

  Of course, if all your personally created files are in /home/debian (or
somewhere under /home) you could use "tar" to collect the /home directory
into one file, use sftp to copy that file to your main computer. Create a
fresh SD card with a plain OS image, boot from that, do the usual apt-get
update/apt-get upgrade, use sftp to put the tar archive to the new card,
then use tar to extract the home directory contents.

tar -cvzf /backup.tar.gz /home

tar -xvzf /backup.tar.gz /home

Thank you Dennis for your assistance, I really appreciate it! Your input helped me to find the exact procedure for doing it just like you said, using the Windisk Imager.

https://computers.tutsplus.com/articles/how-to-clone-your-raspberry-pi-sd-cards-with-windows–mac-59294

Thanks again!

Lidia

I use this:

sudo /opt/scripts/tools/eMMC/beaglebone-black-make-microSD-flasher-from-eMMC.sh

Dne sobota, 29. oktober 2016 21.18.29 UTC+2 je oseba Lidia Toscano napisala:

Hello,

I did this a while ago using DD which should give you an exact copy of your SD card …but you need to be careful with DD.

I made some notes here but you may need to adjust for your needs.

http://dumb-looks-free.blogspot.fr/2015/01/beaglebone-black-bbb-backup-image-of-sd.html

good luck

Hi,

The below link is no more valid, can you kindly share the valid link to follow the DD commands that worked for you.

Regards,
Mohan

Hi Mohan,

Here’s that link on Wayback machine: https://web.archive.org/web/20161229031015/http://dumb-looks-free.blogspot.fr/2015/01/beaglebone-black-bbb-backup-image-of-sd.html

I am not sure what you specifically need/want to do, but we do have some instructions for backing up SD cards (for Bela) on our wiki page: https://github.com/BelaPlatform/Bela/wiki/Manage-your-SD-card#backing-up-your-sd-card

Keep in mind that some of the information there is Bela-specific and not applicable to other images for the BBB, but you should be able to use that section to back up your data.

Here is a cheat sheet from a friend that works

BBB Duplicating Image

3-25-2020 Ken

For example, if the source is /dev/mmcblk0 and destination is /dev/sda

Source being SD-Card in BBB and destination being hung off USB port

===> Boot off eMMc <===

Shrink the source:

First become superuser

sudo -s

e2fsck -f /dev/mmcblk0p1

resize2fs -M /dev/mmcblk0p1

^^^ It will tell you how big the filesystem now is in 4K blocks.

Divide by 1024 and round up to get the size of the filesystem in 4M blocks.

echo ‘start=8192,bootable’ | sfdisk /dev/sda

Copy the filesystem to the destination.

Fill in the correct number of 4M blocks for COUNT from above

dd if=/dev/mmcblk0p1 of=/dev/sda1 bs=4M count=… conv=fdatasync

Expand filesystem on destination

resize2fs /dev/sda1

Copy bootloader

dd if=/dev/mmcblk0 of=/dev/sda skip=1 seek=1 count=8191 conv=fdatasync

If you want to continue using the old filesystem, Expand it again

resize2fs /dev/mmcblk0p1

===> Remove externally mounted SD-Card on USB adapter

Give the new filesystem a new unique identifier if needed

yes | tune2fs -U random /dev/sda1

If you want to reboot off internal SD-Card use command

reboot

All done