I'm trying to make a backup of my AVD. To speed things up, I like to make incremental backups. Backing up the *.img.qcow2 file(s) is inefficient. I'd like to be able to mount the filesystem that resides on the virtual block device and then back up its contents.

My device is an emulated Nexus 5X running the Android Oreo 8.1 x86 system image with Google services and Play Store. There is no option not to full-disk encrypt the userdata partition. Using adbfs is buggy on recent Android versions, not to mention terribly slow.

cryptsetup appears not to know what to do with the block device. Perhaps there's some sort of magic invocation that will expose the underlying ext4 filesystem for me?

$ file userdata.img
userdata.img: Linux rev 1.0 ext4 filesystem data, UUID=XXXXXX, volume name "data" (extents) (large files)
$ file userdata-qemu.img
userdata-qemu.img: Linux rev 1.0 ext4 filesystem data, UUID=XXXXXX (extents) (large files)
$ file userdata-qemu.img.qcow2
userdata-qemu.img.qcow2: QEMU QCOW Image (v3), has backing file (path userdata-qemu.img), XXXXXX bytes

# qemu-nbd --format qcow2 --connect=/dev/nbd0 userdata-qemu.img.qcow2
# mount -t ext4 /dev/nbd0 /mnt/phone
mount: /mnt/phone: wrong fs type, bad option, bad superblock on /dev/nbd0, missing codepage or helper program, or other error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.