-
Notifications
You must be signed in to change notification settings - Fork 0
Create a disk image for cloning SD cards
SEE THIS https://www.raspberrypi.org/forums/viewtopic.php?f=26&t=5947&start=25
(This one is not so clean: https://www.youtube.com/watch?v=8afcs4y9Igs)
Get the list of disks;
➜ ~ df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 8115268 0 8115268 0% /dev
... etc...
/dev/mmcblk0p1 43436 22136 21300 51% /media/batman/boot
/dev/mmcblk0p2 61341180 4539376 54292404 8% /media/batman/rootfs
My final command: sudo dd if=/dev/mmcblk0 of=backup.img bs=1M count=22000 status=progress
Result: 23.1 GB. Therefore, dd uses bs=1M to be 1024*1024 bytes.
Use dd to create the image. Drop the p1 from the source to get both partitions;
sudo dd bs=4M if=/dev/mmcblk0 of=output_img.iso
Add the status=progress
option, or run sudo kill -USR1 $(pgrep ^dd)
(this makes dd show the progress!).
Mount the image as loop device.
sudo losetup /dev/loop0 output_img.iso
Inform the OS of partition table changes
sudo partprobe /dev/loop0
Start the gui
sudo gparted /dev/loop0
Resize the image at loop0, apply.
dd if=/dev/YOUR_SD_CARD of=/home/YOUR_USERNAME/Desktop/backup.img bs=1m count=1024