In TWRP, I originally intended to only formating Data as F2FS but didn't know that from around Android 5, data is a subfolder under /sdcard and everything in /sdcard is gone. How could I retrive a full image of Android internal storage so that I could try to use some data recovery softwares recovering as much as possible?

  • 1
    Data is not a subfolder of /sdcard this statement in your question is wrong. However both folders /data and /sdcard are located on the same "userdata" partition.
    – Robert
    Jul 10, 2020 at 7:10

1 Answer 1


Well, basically TWRP is a tiny embedded Linux so we could do Linux things in TWRP. First we need to unmount all the unneccessary ones in Mount menu, plug in a big enough flash drive formatted using exFAT (By default, Linux couldn't write NTFS, and FAT32 has file size limitation. You may also need extra power supply to get the HDD working), and mount it. Then go to Adaveced -> Terminal and you get a busybox to play with, like other embedded Linux systems.

For phones using UFS, usually the block device for internal storage is /dev/block/sda, and you could confirm this by checking its size.

# --getsize64 would return size in bytes
~ # blockdev --getsize64 /dev/block/sda

The returned number is the block device's size in bytes. That's around 123.16 gigabytes, consistent with the info available on LineageOS device specs (128 GB).

And for smartphones using EMMC, the block device for it should be /dev/block/mmcblk0, correct me if I am wrong.

Now we could dump all the content of that image into external storage device.

DO NOT WRITE BACK TO INTERNAL STORAGE. You would get your data overwritten and that's why I said unmounting all unneccessary volumes at the beginning.

dd if=/dev/block/sda bs=4096 of=/usb_otg/dump.img

Hint: You could utilize nohup to let dd running at background and continue other tasks in terminal, like:

# The "&" symbol at the end is necessary
nohup dd if=/dev/block/sda bs=4096 of=/usb_otg/dump.img > /usb_otg/dd.log 2>&1 &

After dd finishes, unmount your external drive. Wish you a good luck recovering data.

  • did you recover your data? i doubt it's possible on encrypted device
    – alecxs
    Jul 10, 2020 at 8:02

Not the answer you're looking for? Browse other questions tagged .