Is it possible to save an image created on the SD card to the PC?

Hello everyone,

I have backed up my BBB using the script “beaglebone-black-make-microSD-flasher.from-eMMC.sh”. It was quite successful, after that I used the image recorded on the SD card to restore the system without problems.

My problem is that I would like to save the images that were created in the SD card in the PC, in order to have several releases saved. When I insert the SD card into the PC, I try to open it to make a copy of the image, I get a message saying that it can not be opened and also asks if I want to format the SD card.

Someone could help me to know how I can copy those images to my PC to save them.

Thank you. Greetings,
David.

You don't mention what OS the PC is running. Certain cretinous
operating systems (notably Windows) are unable to read a Linux
partition, thus assume the SD card is "unformatted".

There might be tools that will let you create a raw image from that OS,
but my recommendation would be to boot a Linux or *BSD distribution and
use `dd` to make a back-up of the SD card.

If you could advise us though on what OS you are running, that will help
us give better guidance.

On Mon, 5 Feb 2018 04:41:12 -0800 (PST),
82amdavid@gmail.com declaimed the following:

My problem is that I would like to save the images that were created in the
SD card in the PC, in order to have several releases saved. When I insert
the SD card into the PC, I try to open it to make a copy of the image, I
get a message saying that it can not be opened and also asks if I want to
format the SD card.

  M$ Windows OS?

Someone could help me to know how I can copy those images to my PC to save
them.

  The (apparently deprecated) Win32DiskImager program appears to have the
ability to move in both directions -- so can generate an image file by
reading an SD card (Etcher appears to only support writing an image file TO
SD card).

  However, as I recall, it was rather sensitive to the card used -- I'd
tried to duplicate a card (both nominally 8GB) but the target card (another
brand) was just different enough that the image could not be written (I
think the target card reserved more blocks for overhead, with the result
the original image was now too large for the target).

So I’m relatively comfortable using dd on a linux system to copy the contents of an sd card to an image file. Previously I had run the command…

sudo dd status=progress bs=512 count=$((8192+6955008)) if=/dev/disk4 of=/path/to/image/storage/date +%Y-%m-%d`_image_name.img

`

… and that usually does the trick. However, I’m a bit confused because the count value isn’t lining up with the current card specs. I just created a flasher on a 16GB card using the aforementioned script. But when I insert that sd card to my development laptop and I run…

sudo fdisk -l /dev/sdb

… I get the following output:

`

$ sudo fdisk -l /dev/sdb
[sudo] password for troyw:
Disk /dev/sdb: 14.9 GiB, 15931539456 bytes, 31116288 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
Disklabel type: dos
Disk identifier: 0x55866915

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 8192 31116287 31108096 14.9G 83 Linux

`

My confusion is that I recall the card should be 8192+6955008 sectors long, not 31116287 sectors long… So what happened? Did something change recently in the aforementioned flasher-making script? Does it now automatically expand to the sd card size? Do I need to re-partition the /dev/sdb device and then use the dd command? How would I determine how much I can shrink the partition without losing the data on the image?

Any help would be greatly appreciated.