挂载由Android模拟器创建的qcow2映像 [英] Mount qcow2 image created by Android emulator

查看:372
本文介绍了挂载由Android模拟器创建的qcow2映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试挂载Android模拟器创建的userdata-qemu.img.qcow2文件.以下过程不起作用:

I'm trying to mount the userdata-qemu.img.qcow2 file created by the Android emulator. The following procedure does not work:

sudo qemu-nbd -c /dev/nbd0 ~/.android/avd/Pixel_C_API_27.avd/userdata-qemu.img.qcow2

第一个命令运行良好,但正在运行

First command runs well, but running

sudo qemu-nbd -c /dev/nbd0 ~/.android/avd/Pixel_C_API_27.avd/userdata-qemu.img.qcow2

结果如下:

Fehler: /dev/nbd0: unbekannte Partitionstabelle
Modell: Unbekannt (unknown)                                               
Festplatte  /dev/nbd0:  3146MB
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: unknown
Disk-Flags: 

基本上,它无法识别图像文件中的分区表.您可能想知道

Basically it cannot recognize a partition table in the image file. You may wonder what's the output of

fdisk /dev/nbd0 -l

所以这里是:

Medium /dev/nbd0: 3 GiB, 3145728000 Bytes, 6144000 Sektoren
Einheiten: sectors von 1 * 512 = 512 Bytes
Sektorengröße (logisch/physisch): 512 Bytes / 512 Bytes
I/O Größe (minimal/optimal): 512 Bytes / 512 Bytes

如您所料,安装当然会失败,因为如果分区表本身也无法识别,则无法识别任何分区.感谢您的帮助!

As you could expect already, mounting fails of course, since no partitions can be recognized if the partition table itself cannot be recognized either. Thanks for any help!

我刚刚发现问题一定与Android的用户数据加密有关.由于我从未更改过任何密码,因此仿真器的userdata分区的加密密码必须是默认的"default_password"密码.如何解密该映像以使其能够挂载?

I've just found out that the problem must have to do with Android's userdata encryption. As I've never changed any password the encryption password of the emulator's userdata partition would have to be the default one "default_password". How can I decrypt the image to be able to mount it?

推荐答案

您可以使用以下过程安装userdata-qemu.img.qcow2

You can mount userdata-qemu.img.qcow2 using the following procedure

  1. 将图像转换为原始图像

  1. convert the image to a raw image

qemu-img convert -O raw userdata-qemu.img.qcow2 udata-raw.img

使用losetup设置要安装的环回设备

use losetup to setup a loopback device for mounting

sudo losetup -f -P userdata.img

使用losetup -l查看已设置的设备


losetup -l
NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE                                DIO
/dev/loop0         0      0         0  0 /path/to/userdata.img   0

  • 安装驱动器

  • mount the drive

    
    mkdir /tmp/mnt
    sudo mount /dev/loop0 /tmp/mnt
    

  • 然后ls /tmp/mnt/给出

    app  benchmarktest  benchmarktest64  lost+found  misc  nativetest nativetest64
    

    这篇关于挂载由Android模拟器创建的qcow2映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆