0

I need my SD card to be cloned and shared. One of the obvious way is to use Win32DiskImager. However it has some disadvantages:

  • It's huge: it has a size equals to the size of the cloned SD card (even if I use just a fraction of its capacity)
  • It can be cloned on a same sized SD card only (I'm not shure if it is possible to clone from smaller card to a bigger one, but it is not possible to clone bigger on a smaller)

I heard of PiBakery, but it looks more like a setup solution, not cloning.

So I need something that will allow me to clone my 16 GB SD card to another 8 GB card through Internet with least traffic possible and easiest for the receiving part. Is there anything?

Seamus
  • 23,558
  • 5
  • 42
  • 83
Roman Matveev
  • 433
  • 6
  • 16

4 Answers4

6

Everyone has their favorite solution. Mine is called image-utils. Why?

  1. open-source (and free :)
  2. small footprint - filesize & resources required for execution
  3. creates a portable image file that's easy to store for later use (or distribute)
  4. image-backup will update a previously-created image files
  5. runs concurrently with your system (you can make image backups while your system is running)
  6. creates a small image file size - it doesn't copy empty space.

You can download a .zip containing the code (shell scripts) from the forum link above, or you can sync to it from this github pageNOTE.


NOTE: I am not the author of image-utils, nor do I make any changes at all to the source. I have put it on my GitHub site for my own convenience. I'm happy to share that if you prefer using git to keep your local sources updated (rather than dealing with the .zip file). I maintain sync with the master copy on the Raspberry Pi org's forum with a small script I've written to automate the process.

Seamus
  • 23,558
  • 5
  • 42
  • 83
3

You can always use a partitioning tool capable of resizing Linux partitions to make them smaller, then you only need to clone the part of the SD image which is actually occupied by your partitions. In Linux gparted is a user-friendly graphical tool you could use. If you're on Windows, search for partition managers which support Linux partitions.

Don't try to resize a partition leaving zero free space on it, else you may not be able to boot from it. Leave at least 10% of free space.

Dmitry Grigoryev
  • 28,277
  • 6
  • 54
  • 147
2

You could do backup with rsync to mounted external storage

sudo mount /dev/sdb1 /mnt
sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"}  /mnt

or via network (given you have both computers on the same network, set up vpn or openned destination server ssh port to public internet ):

sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} username@server_ip:/path/to/backup/directory/

To restore this backup to a blank sd card you might need to first flash raspbian to it and then overwrite everything with files from backup. (I will try to update this answer when will have time to actually test this idea)

(One of good sources: https://www.ostechnix.com/backup-entire-linux-system-using-rsync/ )

to reduce network traffic you could use -z flag: -z, --compress compress file data during the transfer ( https://linux.die.net/man/1/rsync ) also, --progress and -v flags might be useful

Rimantas
  • 21
  • 3
0

"One of the" LEAST "obvious way is to use Win32DiskImager". At best this will share all the well known limitations of any of the more reliable image utilities.

There are many possibilities for creating installable images. See Periodic backup of Rpi3 Stretch SD card

I use Backup image of SD Card

It would be possible to extend this to create an image over the internet (assuming your connection allows the appropriate access permissions).

Milliways
  • 62,573
  • 32
  • 113
  • 225