So , i'm using Galaxy Mega (i9152) with a CM13 ROM which i flashed through TWRP. For the sake of running PoGO , i had disabled root through the settings of the SuperSu app in CM13 (the game still didn't run , kept tripping safety net). The phone was running fine up till 2 days ago , after which it started going into bootloop.
so , i googled on how to resolve boot loop and saw that fixing file permissions through TWRP might resolve the issue. i did that BUT i also rooted the phone when TWRP prompted me to install SuperSU , citing that the phone was not rooted. After that , the phone was stuck at Boot Animation (the CM android face) , possibly because i rooted the phone through TWRP.
I had formatted my SD card as internal which meant that it would not work on any other device. All my pics and stuff is on that SD card now. I researched extensively on google to find out a way to decrypt the encrypted SD card and found out that i can decrypt it through linux. i have also recovered the .key file from /data/misc/vold folder and have converted the code into the appropriate 16 byte format through terminal commands.
I have a linux system and i have tried to decrypt it. here's what happens when i run parted -l. (i also wanted to post output of fdisk -l , but my reputation score won't let me post more than 2 links)
since the names "android_expand" and "android_meta" are still showing , i have hope and good reason to believe that my data's still intact !
but when i try to mount it ...
i don't know what to do now , since this is all i knew , all i had :/ , i have no idea what filesystem the encrypted card is. i tried ext4 as described in the guide. maybe if there was some way i could make the fstab file cycle through ALL possible filesystems , hitting the right one and finally mounting my SD card. maybe the mount feature has such an 'auto' feature to auto detect the filesystems ?
I have tried to reflash the SAME ROM without factory resetting , but it gave me an error saying : "error executing updater binary" and also "cannot install on top of incompatible data"
i have cleared the Cache and Dalvik Cache SEVERAL times.
i have backed up the DATA portion , through TWRP , by using ANOTHER SD card in the phone . Also i have backed up SYSTEM portion in the internal storage of the phone. I am just worried about my pics and stuff on SD card. I can't see my encrypted SD card in TWRP , it just shows me O MB in the SD card option in TWRP , possibly because the SD card is encrypted. i have no idea how to access my files in the encrypted SD card through the TWRP file manager. i don't want to lose my data. just please help me recover data from this SD card that has been encrypted by Android Marshmallow. i don't know if my SD card will be detected in the OS as before if i am able to somehow reflash the EXACT SAME rom i was using prior to this disaster.
Just to clarify , i am using my Laptop's internal SD card reader for reading card with Linux (i have ubuntu 16.04 LTS), with an sd card adapter supplied with the card (it's a Kingston 16 GB , SDHC class 4)
if i can somehow access my SD card and retrieve all my data from it , my problem will be solved. please help me out.
P.S : also , at the VERY beginning of this ordeal , by mistake , i MIGHT have created partitions on the SD card , while using the fdisk. i hope that did not wipe the data off the sd card or corrupt it. i CTRL+C'ed out of the utility without saving changes ... so that might be of some hope.
EDIT (1-Dec-2019): This is NOT a duplicate, as can be seen by the solution i provided below. This question represents a much more serious case with adopted storage, where your phone is having problems booting or your OS is corrupted. Kindly let this question remain as it is, as it will prove helpful to advanced users and others who have their files stuck in adopted storage while facing difficulties in accessing their phone's Operating System.