OpenMarine
how do I clone micro-sd cards? - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: How do I...? (https://forum.openmarine.net/forumdisplay.php?fid=3)
+--- Thread: how do I clone micro-sd cards? (/showthread.php?tid=1038)

Pages: 1 2


how do I clone micro-sd cards? - adriaan - 2018-02-23

I have OpenPlotter installed on a RPi, updated en upgraded to the latest version.
That took some time. A backup with a cloned sd-card seemd to be timesaving.

I have tried this and lost a few micro-sd cards.
This is what  I did:
First I find out the name of the device (the sc-card with the fully installed OpenPloter) with fdisk -l
Next I unmount the device
Then I make the image (sudo dd if=/dev/sdb of=~/Documents/openplotter.img)
Then copy the image to a blank micro-sd card (sudo dd if=Documents/openplotter.img of=path-to-the-sdcard (usulally also /dv/sdb))

That should be it, I think. But I never succeeded in getting this card to boot. The best I achieved was getting the colourfull startup screen.

Whar do I do wrong?

Then I start all over.
I wipe the contents  of de card with fdisk -d, make a new partition (fdisk -n), make it bootable (fdisk -a) and create a vfat filesystem (fdisk -t, then choose b).
Then umount and issue the command: sudo mkfs.vfat /dev/sdb.
Often an error occurs. I then have a card which cannot be mounted. Sometimes I can rescue the card by creating a new mountpoint (in the terminal or with "Disk").
But sometimes the card is invisible when I insert it.
I now have 2 sd cards in this state. I must have done something wrong. I would very much like to know what that is.


RE: how do I clone micro-sd cards? - monos - 2018-02-23

Since you are a Linux user, at least that's what it seems, I recommend you to use gnome-disk-utility, a disk management tool created by gnome.

I use it instead of the command dd for security and although it does not prevent you from making mistakes if you neglect, it makes it much easier to identify the disks drives and partitions to manipulate them.

[Image: backup-hard-drive-gnome-disk-utility-create-image.jpg]

Remember that you should back up the entire SD and not its partitions.
Here you have a small guide of how to use it is not intended for the Rpi but for hard disks but the management is the same.

https://www.maketecheasier.com/backup-hard-drive-gnome-disk-utility/

If you have any SD that has been rendered useless after manipulating it with dd you can recover it. Just try to restore any *. img file and after a little while if you will cancel the restoration, the disk or SD will remain in a state where you can format it normally and recover it.


RE: how do I clone micro-sd cards? - jim321 - 2018-02-23

just use a usb card reader and the sd card copy program installed under the accessories..


RE: how do I clone micro-sd cards? - adriaan - 2018-02-23

I'll try the disk utility.
Thanks.


RE: how do I clone micro-sd cards? - affinite - 2018-02-24

Sorry for slight thread drift but ...
does anyone know of a way to restore a disc image to a smaller (than the original source card) sized SD card ?
I have built my OP system on a 32GB card which was all had around at the time but I'd now like to setup an off-the-boat clone of the working system and I would really prefer to run on a 16GB card.
When I use the Windows Win32diskimager app to image my SD card I get a 30GB disk image even though less than half of the card is actually used. That of course will not restore to a 16GB card.
Thanks
Steve


RE: how do I clone micro-sd cards? - monos - 2018-02-24

(2018-02-24, 11:10 AM)affinite Wrote: Sorry for slight thread drift but ...
does anyone know of a way to restore a disc image to a smaller (than the original source card) sized SD card ?
I have built my OP system on a 32GB card which was all had around at the time but I'd now like to setup an off-the-boat clone of the working system and I would really prefer to run on a 16GB card.
When I use the Windows Win32diskimager app to image my SD card I get a 30GB disk image even though less than half of the card is actually used. That of course will not restore to a 16GB card.
Thanks
Steve

It's possible. I did it a while ago. But it's not simple. It may be worth reinstalling and configuring OPlotter from scratch, but you can try it if you are interested. I had to do it so as not to lose the oesenc charts I had bought.

https://raspberrypi.stackexchange.com/questions/7177/image-of-a-16gb-card-containing-unpartitioned-space-at-the-end-truncating-possi

The road is windy and winding but you can walk it.


RE: how do I clone micro-sd cards? - petter5 - 2018-02-25

(2018-02-24, 11:10 AM)affinite Wrote: Sorry for slight thread drift but ...
does anyone know of a way to restore a disc image to a smaller (than the original source card) sized SD card ?
I have built my OP system on a 32GB card which was all had around at the time but I'd now like to setup an off-the-boat clone of the working system and I would really prefer to run on a 16GB card.
When I use the Windows Win32diskimager app to image my SD card I get a 30GB disk image even though less than half of the card is actually used. That of course will not restore to a 16GB card.
Thanks
Steve

If running linux, you can install gparted and shrink the image.

assuming using raspbian or ubuntu pc to shrink micro sdcard fitted in a connected card reader
First install gparted  
Code:
sudo apt-get update && sudo apt-get install gparted
to avid any fatal mistakes it is recommended to release all other usb connected storage media except for the micro sd to be shrinked before proceeding.
When your microsd card containing youur old install is plugged into the system, start gparted
Code:
sudo gparted

When gparted have started, use the drop down menu in gparted in the upper right side of the gparted window, and choose your microsd card containing the partition to be shrinked.  chose the partition to be shrinked by selecting the partition with your mouse. when selected go to the menu->partition and choose "rezize/move"  choose the new size and be sure the size will fit on the new microsd card you want to use. when done, press change size.  after the process is finished, you must press the green V  apply all changes.  After this operation, unmount your sd card and put it back. You can now use DD to copy the content to your new card


RE: how do I clone micro-sd cards? - affinite - 2018-02-25

Thanks I will try it


RE: how do I clone micro-sd cards? - seandepagnier - 2018-02-26

(2018-02-25, 10:54 PM)affinite Wrote: Thanks I will try it

You don't have to use gparted.   The simplest way is to shrink the partition, then use dd to copy it.

I had to do this a few days ago.   It's not possible to shrink the partition when it's mounted, so I first used dd to make an image to an external drive, then shrunk the partion in the image.   If you don't have an external drive, it is possible to make a ramdisk with the utilities you need, then switch to that, umounting the root filesystem.


RE: how do I clone micro-sd cards? - adriaan - 2018-02-26

(2018-02-23, 07:14 PM)monos Wrote: Since you are a Linux user, at least that's what it seems, I recommend you to use gnome-disk-utility, a disk management tool created by gnome.

I use it instead of the command dd for security and although it does not prevent you from making mistakes if you neglect, it makes it much easier to identify the disks drives and partitions to manipulate them.

[Image: backup-hard-drive-gnome-disk-utility-create-image.jpg]

Remember that you should back up the entire SD and not its partitions.
Here you have a small guide of how to use it is not intended for the Rpi but for hard disks but the management is the same.

https://www.maketecheasier.com/backup-hard-drive-gnome-disk-utility/

If you have any SD that has been rendered useless after manipulating it with dd you can recover it. Just try to restore any *. img file and after a little while if you will cancel the restoration, the disk or SD will remain in a state where you can format it normally and recover it.



How do you create an image of the SD with Disks when there are 2 partitions; one primary and one extended?
You cannot select both partitions. So I end with an image of either one of the partitions.