Encrypted SD card failed after S5 restart As I can't get my Samsung S5 connected to my Debian 9.1 with KDE machine over MTP I had to use KDE Connect to copy over files.

I then had to move the files from my internal storage to the SD card.

I have both my internal storage as well as the SD card encrypted.

I copied over a lot of files which worked well. Then I ran KDE Connect for a bit longer to transfer a bit more files. I still have over 1 GB of free storage space on my internal disk. However my phone got stuck for quite a while: I could unlock it to see my wallpaper for a few seconds until it went back to the lockscreen (it had very slow reactions). I waited for a while and disabled the WLAN on my computer to stop any data transmissions which didn't help. I hence restarted my phone.

After restart I got greeted with the dialog to encrypt the SD card that said that SD card encryption has been activated and asking me to either enable it by proceeding or deactivating it. On the phone it shows no files on the SD card.

I connected it to my computer where I can see all the files which are unreadable (encrypted). I copied all the encrypted files over in case that helps me restore them and also wrote down the name under which the SD card was mounted.
I also deleted the "LOST.DIR" directory and a couple of files to free up some space in case that was the problem. I dismounted the SD card, reinserted it to my phone and restarted it.

The phone showed me that same dialog again. In searches I could only find questions where people had this problem after software updates or factory resets: but not after just a restart.

Any ideas what might have caused this and how I could fix it?

Note that it doesn't look like I can format the SD card. I could try pressing "deactivate" or proceed at that dialog. But wouldn't that change the decryption keys so that even if I copy my files back it won't be able to decrypt them?
Solution: Follow the steps outlined by Colbe here but format the SD card with GParted on the computer and then format it again on the Android. And leave out step 5.
Likely cause: a missing .MetaEcfsFile file.
Also GParted showed just the &quot;boot&quot; flag for the SD card partition: no &quot;lba&quot; flag.