Thursday, May 16, 2024
 Popular · Latest · Hot · Upcoming
27
rated 0 times [  27] [ 0]  / answers: 1 / hits: 65401  / 3 Years ago, sun, may 23, 2021, 1:46:11

I have created an image of my Raspberry Pi SD-card using dd:



sudo dd if=/dev/sdf of=/home/myusername/raspberry-backup-2014-04-10.img


The SD-card includes two partitions (one vfat, one ext4) which are automatically mounted when I plug the card in.



My question: How can I mount these partitions from the .img file?






More details:



$ fdisk -l raspberry-backup-2014-04-10.img 

Disk raspberry-backup-2014-04-10.img: 3974 MB, 3974103040 bytes
255 heads, 63 sectors/track, 483 cylinders, total 7761920 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
Disk identifier: 0x000981cb

Device Boot Start End Blocks Id System
raspberry-backup-2014-04-10.img1 8192 122879 57344 c W95 FAT32 (LBA)
raspberry-backup-2014-04-10.img2 122880 7761919 3819520 83 Linux

More From » mount

 Answers
0

After some additonal testing I found the solution myself: kpartx



sudo kpartx -a raspberry-backup-2014-04-10.img


This command created /dev/mapper/loop0p1 and /dev/mapper/loop0p2. Afterwards these partitions can be mounted straight forward:



sudo mount -o rw -t ext4 /dev/mapper/loop0p2 mount_target/

[#26094] Monday, May 24, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
pardsea

Total Points: 290
Total Questions: 115
Total Answers: 98

Location: Svalbard and Jan Mayen
Member since Sun, Sep 25, 2022
2 Years ago
;