Make Image from Raspberry pi SD Card Put it back on. Mount an Image

Quite simple works with dd command:

first insert the sdcard into an linux computer. perhaps it gets automatically mounted.

if so unmount every partition. therefor its useful to check on which mountpoints the crad is mounted

do that with the simple

mount

the output looks like this

/dev/mmcblk0p6 on /media/pi/boot
umount /dev/mmcblk0p6

command. after unmounting ALL partitions

use the dd command, not on a partition but on the whole device (in case of an sdcrad its simple the path without p6)

dd if=/dev/mmcblk0 of=/home/pi/backup.img

thats it.

Now in case of putting this image back on an sdcrad just use dd command aswell like this

dd if=/home/pi/backup.img of=/dev/mmcblk0

or mount the image into a loop device on your current pc machine, so that you can change datas or copy files like this:

1.

fdisk -l /home/pi/backup.img

output is like this:

/home/pi/backuo.img1 8192 2357421 2349230 1,1G e W95 FAT16 (LBA)
/home/pi/backuo.img2 2357422 15523839 13166418 6,3G 85 Linux extended
/home/pi/backuo.img5 2359296 2424829 65534 32M 83 Linux
/home/pi/backuo.img6 2424832 2553855 129024 63M c W95 FAT32 (LBA)
/home/pi/backuo.img7 2555904 15523839 12967936 6,2G 83 Linux

2. look at the partition with the largest size in this case the last one.
3. calculate the startposition first number * 512
4. put this into the mount command as offset like this:

mount -v -o offset=1308622848 -t ext4 /home/pi/backuo.img /mnt/sdc

 

thats all 🙂

Posted in Linux, Raspberry PI Tagged with: , , , ,

Leave a Reply