The officially official Devuan Forum!

You are not logged in.

#1 2018-07-22 20:24:43

0xf4b10
Member
Registered: 2018-05-12
Posts: 33  

Mount android disk image inside linux

Hey guys
I've done a copy of my android phone disk into an image file but now I can't mount it in order to inspect (i wanna run photorec on it to recover some files...).
To obtain the image file I just copied the dev block from the device:

adb pull /dev/block/mmcblk0 ~/imagem-thea-20180722.img

Now I'm trying to mount it but is returning the error message:

$ sudo mount -t msdos -o ro,loop imagem-thea-20180722.img mnt/

mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

Some info on the file:

$ file imagem-thea-20180722.img

imagem-thea-20180722.img: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,1), end-CHS (0x3ff,255,63), startsector 1, 4294967295 sectors, extended partition table (last)

$ sudo fdisk -l imagem-thea-20180722.img  

                                       

Disk imagem-thea-20180722.img: 14.7 GiB, 15758000128 bytes, 30777344 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
Disklabel type: gpt
Disk identifier: 98101B32-BBE2-4BF2-A06E-2BB33D000C20

Device                       Start      End  Sectors  Size Type
imagem-thea-20180722.img1      256   131327   131072   64M Microsoft basic data
imagem-thea-20180722.img2   131328   132351     1024  512K unknown
imagem-thea-20180722.img3   132352   132415       64   32K unknown
imagem-thea-20180722.img4   132608   134631     2024 1012K unknown
imagem-thea-20180722.img5   135608   136007      400  200K unknown
imagem-thea-20180722.img6   136608   137407      800  400K unknown
imagem-thea-20180722.img7   137608   137671       64   32K unknown
imagem-thea-20180722.img8   137672   138695     1024  512K unknown
imagem-thea-20180722.img9   138696   142791     4096    2M unknown
imagem-thea-20180722.img10  142792   147455     4664  2.3M Microsoft basic data
imagem-thea-20180722.img11  147456   149479     2024 1012K unknown
imagem-thea-20180722.img12  150456   150855      400  200K unknown
imagem-thea-20180722.img13  151456   152255      800  400K unknown
imagem-thea-20180722.img14  152456   152519       64   32K Microsoft basic data
imagem-thea-20180722.img15  152520   153543     1024  512K unknown
imagem-thea-20180722.img16  153600   154623     1024  512K unknown
imagem-thea-20180722.img17  154624   155703     1080  540K Microsoft basic data
imagem-thea-20180722.img18  155704   158775     3072  1.5M unknown
imagem-thea-20180722.img19  158776   161847     3072  1.5M unknown
imagem-thea-20180722.img20  161848   162823      976  488K unknown
imagem-thea-20180722.img21  162824   162887       64   32K unknown
imagem-thea-20180722.img22  163072   166143     3072  1.5M unknown
imagem-thea-20180722.img23  166144   166145        2    1K unknown
imagem-thea-20180722.img24  166146   166161       16    8K unknown
imagem-thea-20180722.img25  166162   168209     2048    1M unknown
imagem-thea-20180722.img26  168210   168465      256  128K unknown
imagem-thea-20180722.img27  168466   174609     6144    3M unknown
imagem-thea-20180722.img28  174610   182801     8192    4M unknown
imagem-thea-20180722.img29  182802   190993     8192    4M unknown
imagem-thea-20180722.img30  191232   207615    16384    8M Microsoft basic data
imagem-thea-20180722.img31  207616   208639     1024  512K unknown
imagem-thea-20180722.img32  208640   229039    20400   10M unknown
imagem-thea-20180722.img33  229040   249599    20560   10M unknown
imagem-thea-20180722.img34  249600   251647     2048    1M Microsoft basic data
imagem-thea-20180722.img35  251648   284415    32768   16M Microsoft basic data
imagem-thea-20180722.img36  284416   300799    16384    8M unknown
imagem-thea-20180722.img37  300800   327679    26880 13.1M Microsoft basic data
imagem-thea-20180722.img38  327680   360447    32768   16M unknown
imagem-thea-20180722.img39  360448   425983    65536   32M Microsoft basic data
imagem-thea-20180722.img40  425984  4521983  4096000    2G Microsoft basic data
imagem-thea-20180722.img41 4521984  5033983   512000  250M Microsoft basic data
imagem-thea-20180722.img42 5033984 30711551 25677568 12.2G Microsoft basic data

Can anyone help me in what I'm doing wrong here? thanks in advance

Offline

#2 2018-07-22 23:19:46

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,253  

Re: Mount android disk image inside linux

If /dev/mmcblk0 was the full disk, you can't mount the image file directly. One solution to that would be to use nbd (network block device) where you set up the nbd server to use the image file, and then "install it" to the system with an nbd client, which would create a series of /dev/nbd0p1, /dev/nbd0p2, ... points for the partitions and subsequent file system mounting.

However, I don't think file recognizes the image correctly, but rather that the image is a raw NAND image, which needs to be pulled as such. It's a fair while since I was blistering my eyebrows on that problem, and apart from me having forgotten most of it, the details of the story are probably quite different nowadays anyhow. I can only suggest that you follow up on reading/writing NAND images.

Offline

#3 2018-08-07 23:41:27

0xf4b10
Member
Registered: 2018-05-12
Posts: 33  

Re: Mount android disk image inside linux

actually with a fast read on photorec man solved the problem, it happens I need only to call it passing the image file and it does the search automatically without having to mount

Offline

#4 2018-09-16 08:15:28

neutron_stz
Member
Registered: 2018-09-16
Posts: 9  

Re: Mount android disk image inside linux

try to mount with offset for desired partition:

-o offset=$((START_SECTOR_OF_PARTITION*512))

example for partition 42:

-o offset=$((5033984*512))

Offline

#5 2018-09-30 18:52:32

0xf4b10
Member
Registered: 2018-05-12
Posts: 33  

Re: Mount android disk image inside linux

neutron_stz wrote:

try to mount with offset for desired partition:

-o offset=$((START_SECTOR_OF_PARTITION*512))

example for partition 42:

-o offset=$((5033984*512))

Hey, that did the trick
thanks a lot

Offline

Board footer