[General Questions and Answers] jtpiano:
I am trying to take an image of my Android phone. Specifically I have tried to image the system and boot partitions. The imaging process appears to work correctly when using dd. However, when I attempt to mount the image in a loopback device the image appears to be empty. I also tried to see file contents by piping through cpio. Basically, I am trying to validate the image that I took. What am I doing wrong? Is there a problem with how I took the image or validation or both? Here are the steps to took (you'll see only the system partition below but I used the same process for boot)

[root@localhost platform-tools]# ./adb devices

List of devices attached

99000421100783 device

[root@localhost platform-tools]#./adb shell

shell@C6730:/ $ su

root@C6730:/ # cat /proc/partitions

major minor #blocks name

179 0 7634944 mmcblk0

179 1 65536 mmcblk0p1

179 2 1024 mmcblk0p2

179 3 1024 mmcblk0p3

179 4 1024 mmcblk0p4

179 5 1024 mmcblk0p5

179 6 1024 mmcblk0p6

179 7 1024 mmcblk0p7

179 8 1024 mmcblk0p8

179 9 1024 mmcblk0p9

179 10 16384 mmcblk0p10

179 11 1024 mmcblk0p11

179 12 1024 mmcblk0p12

179 13 1024 mmcblk0p13

179 14 1536 mmcblk0p14

179 15 1536 mmcblk0p15

179 16 2048 mmcblk0p16

179 17 8192 mmcblk0p17

179 18 4096 mmcblk0p18

179 19 8192 mmcblk0p19

179 20 8192 mmcblk0p20

179 21 819200 mmcblk0p21

179 22 658432 mmcblk0p22

179 23 16384 mmcblk0p23

179 24 6144 mmcblk0p24

179 25 8192 mmcblk0p25

179 26 1024 mmcblk0p26

179 27 1024 mmcblk0p27

179 28 5120 mmcblk0p28

179 29 4718592 mmcblk0p29

179 30 1048576 mmcblk0p30

179 31 8192 mmcblk0p31

259 0 20480 mmcblk0p32

259 1 4096 mmcblk0p33

259 2 16384 mmcblk0p34

259 3 16384 mmcblk0p35

259 4 1024 mmcblk0p36

259 5 1024 mmcblk0p37

259 6 1024 mmcblk0p38

259 7 1024 mmcblk0p39

259 8 20480 mmcblk0p40

259 9 20480 mmcblk0p41

259 10 4096 mmcblk0p42

259 11 4096 mmcblk0p43

259 12 95215 mmcblk0p44

179 32 512 mmcblk0rpmb

179 64 30183936 mmcblk1

179 65 30182912 mmcblk1p1

254 0 4718592 dm-0

254 1 1048576 dm-1

root@C6730:/ # parted /dev/block/mmcblk0

GNU Parted 1.8.8.1.179-aef3

Using /dev/block/mmcblk0

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) print

print

Model: MMC 8WMB3R (sd/mmc)

Disk /dev/block/mmcblk0: 7818MB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Number Start End Size File system Name Flags

1 4194kB 71.3MB 67.1MB fat16 modem

2 71.3MB 72.4MB 1049kB sbl1

3 72.4MB 73.4MB 1049kB sbl1bak

4 73.4MB 74.4MB 1049kB sdi

5 75.5MB 76.5MB 1049kB DDR

6 79.7MB 80.7MB 1049kB aboot

7 80.7MB 81.8MB 1049kB abootbak

8 81.8MB 82.8MB 1049kB rpm

9 82.8MB 83.9MB 1049kB rpmbak

10 83.9MB 101MB 16.8MB boot

11 101MB 102MB 1049kB tz

12 102MB 103MB 1049kB tzbak

13 103MB 104MB 1049kB pad

14 104MB 105MB 1573kB modemst1

15 105MB 107MB 1573kB modemst2

16 107MB 109MB 2097kB reserve1

17 109MB 117MB 8389kB dnand

18 117MB 122MB 4194kB bfss1

19 122MB 130MB 8389kB bfss2

20 130MB 138MB 8389kB ext4 persist

21 138MB 977MB 839MB ext4 system

22 977MB 1652MB 674MB ext4 cache

23 1652MB 1668MB 16.8MB recovery

24 1668MB 1675MB 6291kB misc

25 1678MB 1686MB 8389kB fsg

26 1686MB 1687MB 1049kB fsc

27 1687MB 1688MB 1049kB ssd

28 1688MB 1693MB 5243kB reserve2

29 1693MB 6525MB 4832MB userdata

30 6525MB 7599MB 1074MB internalstorage

31 7599MB 7607MB 8389kB ext4 sysprop

32 7607MB 7628MB 21.0MB ext4 carrier

33 7628MB 7633MB 4194kB fotamng

34 7633MB 7649MB 16.8MB fota

35 7649MB 7666MB 16.8MB fotabk

36 7666MB 7667MB 1049kB sdibk

37 7667MB 7668MB 1049kB abootbk

38 7668MB 7669MB 1049kB rpmbk

39 7669MB 7670MB 1049kB tzbk

40 7670MB 7691MB 21.0MB log

41 7691MB 7712MB 21.0MB logwork

42 7712MB 7716MB 4194kB bootwork

43 7716MB 7721MB 4194kB rom

44 7721MB 7818MB 97.5MB reserve3

(parted) q

q

root@C6730:/ # cd /dev/block/platform/msm_sdcc.1/by-name

root@C6730:/dev/block/platform/msm_sdcc.1/by-name # ls -l

lrwxrwxrwx root root 1969-12-31 19:17 DDR -> /dev/block/mmcblk0p5

lrwxrwxrwx root root 1969-12-31 19:17 aboot -> /dev/block/mmcblk0p6

lrwxrwxrwx root root 1969-12-31 19:17 abootbak -> /dev/block/mmcblk0p7

lrwxrwxrwx root root 1969-12-31 19:17 abootbk -> /dev/block/mmcblk0p37

lrwxrwxrwx root root 1969-12-31 19:17 bfss1 -> /dev/block/mmcblk0p18

lrwxrwxrwx root root 1969-12-31 19:17 bfss2 -> /dev/block/mmcblk0p19

lrwxrwxrwx root root 1969-12-31 19:17 boot -> /dev/block/mmcblk0p10

lrwxrwxrwx root root 1969-12-31 19:17 bootwork -> /dev/block/mmcblk0p42

lrwxrwxrwx root root 1969-12-31 19:17 cache -> /dev/block/mmcblk0p22

lrwxrwxrwx root root 1969-12-31 19:17 carrier -> /dev/block/mmcblk0p32

lrwxrwxrwx root root 1969-12-31 19:17 dnand -> /dev/block/mmcblk0p17

lrwxrwxrwx root root 1969-12-31 19:17 fota -> /dev/block/mmcblk0p34

lrwxrwxrwx root root 1969-12-31 19:17 fotabk -> /dev/block/mmcblk0p35

lrwxrwxrwx root root 1969-12-31 19:17 fotamng -> /dev/block/mmcblk0p33

lrwxrwxrwx root root 1969-12-31 19:17 fsc -> /dev/block/mmcblk0p26

lrwxrwxrwx root root 1969-12-31 19:17 fsg -> /dev/block/mmcblk0p25

lrwxrwxrwx root root 1969-12-31 19:17 internalstorage -> /dev/block/mmcblk0p30

lrwxrwxrwx root root 1969-12-31 19:17 log -> /dev/block/mmcblk0p40

lrwxrwxrwx root root 1969-12-31 19:17 logwork -> /dev/block/mmcblk0p41

lrwxrwxrwx root root 1969-12-31 19:17 misc -> /dev/block/mmcblk0p24

lrwxrwxrwx root root 1969-12-31 19:17 modem -> /dev/block/mmcblk0p1

lrwxrwxrwx root root 1969-12-31 19:17 modemst1 -> /dev/block/mmcblk0p14

lrwxrwxrwx root root 1969-12-31 19:17 modemst2 -> /dev/block/mmcblk0p15

lrwxrwxrwx root root 1969-12-31 19:17 pad -> /dev/block/mmcblk0p13

lrwxrwxrwx root root 1969-12-31 19:17 persist -> /dev/block/mmcblk0p20

lrwxrwxrwx root root 1969-12-31 19:17 recovery -> /dev/block/mmcblk0p23

lrwxrwxrwx root root 1969-12-31 19:17 reserve1 -> /dev/block/mmcblk0p16

lrwxrwxrwx root root 1969-12-31 19:17 reserve2 -> /dev/block/mmcblk0p28

lrwxrwxrwx root root 1969-12-31 19:17 reserve3 -> /dev/block/mmcblk0p44

lrwxrwxrwx root root 1969-12-31 19:17 rom -> /dev/block/mmcblk0p43

lrwxrwxrwx root root 1969-12-31 19:17 rpm -> /dev/block/mmcblk0p8

lrwxrwxrwx root root 1969-12-31 19:17 rpmbak -> /dev/block/mmcblk0p9

lrwxrwxrwx root root 1969-12-31 19:17 rpmbk -> /dev/block/mmcblk0p38

lrwxrwxrwx root root 1969-12-31 19:17 sbl1 -> /dev/block/mmcblk0p2

lrwxrwxrwx root root 1969-12-31 19:17 sbl1bak -> /dev/block/mmcblk0p3

lrwxrwxrwx root root 1969-12-31 19:17 sdi -> /dev/block/mmcblk0p4

lrwxrwxrwx root root 1969-12-31 19:17 sdibk -> /dev/block/mmcblk0p36

lrwxrwxrwx root root 1969-12-31 19:17 ssd -> /dev/block/mmcblk0p27

lrwxrwxrwx root root 1969-12-31 19:17 sysprop -> /dev/block/mmcblk0p31

lrwxrwxrwx root root 1969-12-31 19:17 system -> /dev/block/mmcblk0p21

lrwxrwxrwx root root 1969-12-31 19:17 tz -> /dev/block/mmcblk0p11

lrwxrwxrwx root root 1969-12-31 19:17 tzbak -> /dev/block/mmcblk0p12

lrwxrwxrwx root root 1969-12-31 19:17 tzbk -> /dev/block/mmcblk0p39

lrwxrwxrwx root root 1969-12-31 19:17 userdata -> /dev/block/mmcblk0p29

root@C6730:/ # dd if=/dev/block/mmcblk0p21 of=/mnt/media_rw/sdcard0/firmware-img/kyocerasystem.img bs=4096 conv=noerror,sync

204800+0 records in

204800+0 records out

838860800 bytes transferred in 40.461 secs (20732577 bytes/sec)

root@C6730:/ # exit

shell@C6730:/ $ exit

[root@localhost jeremy]:/ # losetup /dev/loop0 /home/jeremy/kyocerasystem.img

[root@localhost jeremy]:/ # mkfs.ext4 /dev/loop0

mke2fs 1.42.9 (28-Dec-2013)

Discarding device blocks: 4096/204800: done

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

51296 inodes, 204800 blocks

10240 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=209715200

7 block groups

32768 blocks per group, 32768 fragments per group

7328 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840

Allocating group tables: 0/7: done

Writing inode tables: 0/7: done

Creating journal (4096 blocks): done

Writing superblocks and filesystem accounting information: 0/7: done

[root@localhost jeremy]:/ # mount -t ext4 /dev/loop0 /mnt

[root@localhost jeremy]:/ # cd /mnt

[root@localhost jeremy]:/ # ls

lost+found

root@localhost jeremy]# dd if=kyocerasystem.img | cpio -ictv > kyocerasystem.txt

1638400+0 records in

1638400+0 records out

838860800 bytes (839 MB) copied, 25.1643 s, 33.3 MB/s

cpio: premature end of file

[root@localhost jeremy]:/ # less kyocerasystem.txt

(no contents to display - empty)