How to decrypt and split adopted storage?

Search This thread

POQDavid

Senior Member
Aug 14, 2011
193
25
about.me
Xiaomi Redmi 8
How to partition and to have adopted storage at same time.
You don't need to root your device but the device i done this with is rooted
  1. You need to enabled Developer Options.
  2. Enable the USB Debugging option.
  3. Make sure your SD card is formatted as portable, then get the adb executable from android sdk or any other source.
  4. Connect your device to your PC and run the adb devices command. If your device is connected correctly you will see your device listed in the output.
  5. Run adb shell sm list-disks adoptable. This will show you the list of disks that can be used for what we want.
  6. For my device it showed me disk:179,128 so i ran adb shell sm partition disk:179,128 mixed 80 on my 32 GB SD card. It gave me 5 GB as adoptable storage and the rest for other uses. (This will format your SD card.)

How to decrypt adopted storage.
  1. Your device must be rooted.
  2. Using a file browser like ES Explorer, browse to /data/misc/vold.
  3. The .key file there is the encryption key of your adopted storage.
  4. Open that file with a hex editor to view the 16-byte key.
  5. On any Linux distro you can do this first mount your SD card, in my case SD card was mounted at /dev/sdb2.
  6. Then run this command dmsetup create crypt1 --table "0 `blockdev --getsize /dev/sdb2` crypt aes-cbc-essiv:sha256 <You put the 16 bytes of hex data from the file here> 0 /dev/sdb2 0" This might give you a error but ignore it.
  7. If your key is correct you can mount it by mount -t ext4 /dev/mapper/crypt1 /mnt/1/
  8. Finally you can run cd /mnt/1 to browse the decrypted storage.
 
Last edited:

-CustomX-

New member
Aug 20, 2016
1
0
Im lost the key file

Hello, I have the same situation like pedrolemoz.

Unfortunately, I did a hard reset to my cell phone and do not have the .key file stored in it. Do you still have the possibility to decrypt the sd card?
 

POQDavid

Senior Member
Aug 14, 2011
193
25
about.me
Xiaomi Redmi 8
How can I decrypt without the key? I saw something but i don't know how do. Can you help me?

Hello, I have the same situation like pedrolemoz.

Unfortunately, I did a hard reset to my cell phone and do not have the .key file stored in it. Do you still have the possibility to decrypt the sd card?

Ok its not possible to decrypt the SD with no key and you must have made a copy once you encrypted the SD
 

sebx_g1

Senior Member
Nov 6, 2009
2,949
711
Samsung Galaxy Watch 4
I had sdcard setup as adopted storage when I remove it from the phone it is not accesible in any way on the phone also is this possible to open it ? Any tool avaiable ?
This sdcard insided again to phone also don't work why ?
 
Last edited:

sebx_g1

Senior Member
Nov 6, 2009
2,949
711
Samsung Galaxy Watch 4
Yes but system says it is corrupted and only option is to reformat sdcard... It is quite confusing situation isn't it?

Wysłane z mojego ASUS_Z00A przy użyciu Tapatalka
 

_mRkZ_

Member
Nov 29, 2013
28
7
www.liveyourtech.it
Same problem here :\
I put my sdcard on my i9505 and from adb i run "su mount", this is what i get:
Code:
130|jfltexx:/ # mount
rootfs on / type rootfs (ro,seclabel,relatime)
tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,mode=755)
devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600)
proc on /proc type proc (rw,relatime,gid=3009,hidepid=2)
sysfs on /sys type sysfs (rw,seclabel,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,seclabel,relatime)
none on /acct type cgroup (rw,relatime,cpuacct)
tmpfs on /mnt type tmpfs (rw,seclabel,relatime,mode=755,gid=1000)
none on /config type configfs (rw,relatime)
none on /dev/cpuctl type cgroup (rw,relatime,cpu)
none on /dev/bfqio type cgroup (rw,relatime,bfqio)
/dev/block/mmcblk0p16 on /system type ext4 (ro,seclabel,relatime,errors=panic,data=ordered)
/dev/block/mmcblk0p1 on /firmware type vfat (ro,context=u:object_r:firmware_file:s0,relatime,uid=1000,gid=1000,fmask=0337,dmask=0227,codepage=cp437,iocharset=iso8859-1,shortname=lower,errors=remount-ro)
/dev/block/mmcblk0p2 on /firmware-mdm type vfat (ro,context=u:object_r:firmware_file:s0,relatime,uid=1000,gid=1000,fmask=0337,dmask=0227,codepage=cp437,iocharset=iso8859-1,shortname=lower,errors=remount-ro)
/dev/block/mmcblk0p10 on /efs type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,journal_async_commit,noauto_da_alloc,errors=panic,data=ordered)
/dev/block/mmcblk0p18 on /cache type f2fs (rw,seclabel,nosuid,nodev,noatime,background_gc=on,user_xattr,inline_xattr,acl,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6)
/dev/block/mmcblk0p29 on /data type f2fs (rw,seclabel,nosuid,nodev,noatime,background_gc=on,user_xattr,inline_xattr,acl,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6)
tmpfs on /storage type tmpfs (rw,seclabel,relatime,mode=755,gid=1000)
/data/media on /mnt/runtime/default/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,uid=1023,gid=1023,multiuser)
/data/media on /storage/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,uid=1023,gid=1023,multiuser)
/data/media on /mnt/runtime/read/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,uid=1023,gid=1023,multiuser)
/data/media on /mnt/runtime/write/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,uid=1023,gid=1023,multiuser)

Tried also to put my sdcard on a linux OS.. but can not find the filesystem..

Any solution ? :\
How can I reach the .key file?
 

uptwolait

Member
Feb 22, 2017
28
6
Question on how to decrypt adopted storage... on phone

How to decrypt adopted storage.
  1. Your device must be rooted.
  2. Using a file browser like ES Explorer, browse to /data/misc/vold.
  3. The .key file there is the encryption key of your adopted storage.
  4. Open that file with a hex editor to view the 16-byte key.
  5. On any Linux distro you can do this first mount your SD card, in my case SD card was mounted at /dev/sdb2.
  6. Then run this command dmsetup create crypt1 --table "0 `blockdev --getsize /dev/sdb2` crypt aes-cbc-essiv:sha256 <You put the 16 bytes of hex data from the file here> 0 /dev/sdb2 0" This might give you a error but ignore it.
  7. If your key is correct you can mount it by mount -t ext4 /dev/mapper/crypt1 /mnt/1/
  8. Finally you can run cd /mnt/1 to browse the decrypted storage.

In steps 5 - 8, it says to use a linux computer to perform the commands. As I don't have a linux computer, I was wondering if those steps can be done on the Android phone, using Busybox and Android Terminal Emulator? If so, what would be the steps to do it (assuming they differ some from the ones posted there)?

Maybe the better question would be, is there a straight-forward way to decrypt the storage ON THE ANDROID DEVICE, so the SD card doesn't have to be removed and read in another machine?
 

POQDavid

Senior Member
Aug 14, 2011
193
25
about.me
Xiaomi Redmi 8
In steps 5 - 8, it says to use a linux computer to perform the commands. As I don't have a linux computer, I was wondering if those steps can be done on the Android phone, using Busybox and Android Terminal Emulator? If so, what would be the steps to do it (assuming they differ some from the ones posted there)?

Maybe the better question would be, is there a straight-forward way to decrypt the storage ON THE ANDROID DEVICE, so the SD card doesn't have to be removed and read in another machine?
Well its possible i am sure android must have dmsetup and you can give it a try i never done it on android device using Busybox
 

Dr.ahmed3386

Member
Jun 2, 2017
5
0
How i Decrypt in windows enviroment

Dear I rooted my phone and get the .key file and actually they were 2 file
expand_8e6f0fc23f14e31581c6c0ded8a2bb5f.key
expand_a80d5d8eddaee648fd1f0f14cbb88ae2.key

I want to decrypt my adopted sd card to be able to repartition it again and return it into 1 partition 128gb

Please help
 

Dr.ahmed3386

Member
Jun 2, 2017
5
0
Dear I rooted my phone and get the .key file and actually they were 2 file
expand_8e6f0fc23f14e31581c6c0ded8a2bb5f.key
expand_a80d5d8eddaee648fd1f0f14cbb88ae2.key

I want to decrypt my adopted sd card to be able to repartition it again and return it into 1 partition 128gb

Please help

I download Ubuntu and install it and yet I could not decrypt my SD card using terminal and this commands.
Please Help
 

CheifX

Member
Feb 20, 2017
27
0
Hello!!!!

Ok its not possible to decrypt the SD with no key and you must have made a copy once you encrypted the SD
i have created a backup of that .key file but after few days i formatted my Android and after placing it back to its folder my sdcard is still not working. i mean my sdcard is fully readed by my android device and i can write on it to but my old files are not showing but they are in sdcard because my stotage info is proving it.
 

Attachments

  • Screenshot_20170703-031746.png
    Screenshot_20170703-031746.png
    76.6 KB · Views: 281

POQDavid

Senior Member
Aug 14, 2011
193
25
about.me
Xiaomi Redmi 8
i have created a backup of that .key file but after few days i formatted my Android and after placing it back to its folder my sdcard is still not working. i mean my sdcard is fully readed by my android device and i can write on it to but my old files are not showing but they are in sdcard because my stotage info is proving it.
maybe try to copy your data using a linux distro like mint just to be safe then see if you can find the files or not
 

Okabiz

Member
Dec 25, 2017
8
0
Is it possible to perform the decryption on a guest Ubuntu virtual machine (windows as a host) ? I followed a tutorial on how to link my sdcard onto the virtual machine, but I cannot seem to mount it in Ubuntu I get a "wrong fs type, bad option, bad superblock on /dev/sdb2" error, any help ?
 

fanfzero

Senior Member
Jan 22, 2014
266
72
Hi @POQDavid , I ve done the procedure, I can access the files and everything, but my question is, how do I format the sd to make it standard again?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    How to partition and to have adopted storage at same time.
    You don't need to root your device but the device i done this with is rooted
    1. You need to enabled Developer Options.
    2. Enable the USB Debugging option.
    3. Make sure your SD card is formatted as portable, then get the adb executable from android sdk or any other source.
    4. Connect your device to your PC and run the adb devices command. If your device is connected correctly you will see your device listed in the output.
    5. Run adb shell sm list-disks adoptable. This will show you the list of disks that can be used for what we want.
    6. For my device it showed me disk:179,128 so i ran adb shell sm partition disk:179,128 mixed 80 on my 32 GB SD card. It gave me 5 GB as adoptable storage and the rest for other uses. (This will format your SD card.)

    How to decrypt adopted storage.
    1. Your device must be rooted.
    2. Using a file browser like ES Explorer, browse to /data/misc/vold.
    3. The .key file there is the encryption key of your adopted storage.
    4. Open that file with a hex editor to view the 16-byte key.
    5. On any Linux distro you can do this first mount your SD card, in my case SD card was mounted at /dev/sdb2.
    6. Then run this command dmsetup create crypt1 --table "0 `blockdev --getsize /dev/sdb2` crypt aes-cbc-essiv:sha256 <You put the 16 bytes of hex data from the file here> 0 /dev/sdb2 0" This might give you a error but ignore it.
    7. If your key is correct you can mount it by mount -t ext4 /dev/mapper/crypt1 /mnt/1/
    8. Finally you can run cd /mnt/1 to browse the decrypted storage.