Since December 2013 I'm an owner of a Sony Xperia Z Tablet and until this week I never had to rant about it. Hell I have even decided to stay with the original Sony Android version and to not install Cyanogenmod, because Sony did a fine job and didn't f%ck up Android as much as other device vendors do. The number of Sony bloatware is limited and is not intrusive... but let's get back to my rant.

Since the last device update to build number 10.5.A.0.230, admittedly a while ago, I cannot use my SD card anymore. I usually use the AndSMB app to transfer the movie I want to prepare for the travel directly from my NAS onto the SD card. It used to work flawlessly but when I copied two days ago, I got a "Permission denied" error in the AndSMB app. At first I suspected a bug in the AndSMB application because there was a recent update of the app, too. I also rebooted the tablet, just to make sure it's not a mounting issue of the AndSMB app. I tried the transfer again yesterday and the "Permission denied" was still there. So I got curious and opened "File Manager" app and tried to manually create a file on my SD card (which has worked before) and got an error "Operation Failed." which appeared for about 2 seconds at the bottom of the app.

At this point I realized, that with the update to build 10.5.A.0.230, I had also received the Android version 4.4, also known as KitKat. Now search for "Kitkat sd card" and you get thousands of websites cussing and swearing about Google having removed the write access to all apps (except their own!) to the (external) SD card. See this Google+ post by Tod Liebeck for a good summary of what exactly happened in KitKat. He sums it up so that every idiot can understand it:

"What this means is that with KitKat, applications will no longer be able create, modify, or remove files and folders on your external SD card."

Google, just what the hell were you thinking?! Yes ok, applications can no longer just create files in a chaotic and anarchic way. But what about users like me wanting to place large media files on the SD card. On purpose! What about applications running on the SD card? They stop working because they can no longer write to the folder they were installed/moved into. Additionally to this, there seems to have been no information at all about that change so users and application developers were left out in the dark and have to spend time in figuring out what the hell is going on and why such permission errors occur. Agreed, power users, not the usual oh-free-wifi-internet-hipster in Starbucks.

After a couple of minutes of research on this newly introduced limitation of Android (with a couple of swear words leaving my mouth), I was thinking of formatting the tablet completely and install CyanogenMod 11 on it. According to this Reddit post, CM seems to have removed the SD card write limitations. But before that I wanted to see if I could somehow fix it myself. After all I'm a Linux Sys Engineer and Android is running on Linux (somewhat but not exactly)... I installed the "Terminal Emulator" app and navigated to the SD card path:

I tried to change the folder permissions of sdcard1 (which is the external SD card) to 777:

u0_a44@SGP321: /storage $ chmod 777 sdcard1

But that didn't work. The permissions stayed the same (Note: Even as root you cannot change that folder's permissions because of enabled SELinux).
Maybe it's just an issue with the FAT filesystem I thought and was then checking the Google Play store for an app to completely re-format the SD card to ext4 - but to my big surprise my search of "sd card" showed the app "SDFix: KitKat Writable MicroSD" by NextApp as one of the first results. Wow! That's exactly what I need!!! But the app's description mentions that root access is required. As I haven't rooted my tablet, I needed to find a way to root the device first. A quick research "root xperia z tablet" pointed me to quite a lot of results, some with large manuals, some to discussion threads in the xda forums. In the xda forums I saw the name "towelroot" appear very often. And that's where the solution for this whole SD card write permission issue starts.

General information and disclaimer: You do this at your own risk. If you brick your device it's your own fault.
I did these steps successfully on a Xperia Z Tablet (model number SGP321) running on Android 4.4.2 and build 10.5.A.0.230 with Kernel version 3.4.0-perf-g32ce454.

1. Download towelroot application to root your deviceOn your tablet, open a browser and navigate to https://towelroot.com/. Click on the red sign to download the application package "tr.apk".

2. Install towelrootOn your tablet you will find the downloaded tr.apk in the "Downloads" folder. Launch a file explorer and click on tr.apk. Your system might tell you that the current settings do not allow to install apps from untrusted sources. In this case go to the Settings -> Security and under "Device Administration" click on "Unknown sources". Now you can install tr.apk:

Funnily a warning appears, that Google does not recommend the installation of this package. Well Google, you left me no choice!

3. Root the deviceThis sounds complicated but it is the easiest thing ever thanks to the towelroot application by geohot (yes, that's the guy who hacked the PlayStation!). Launch the towelroot application and click on the "make it ra1n" button.

If the rooting process was successful, the following text appears: "Thank you for using towelroot! You should have root, no reboot required.".

Amazing. It worked. Becoming root in "Terminal Emulator" now works.

4. Install SDFixNow that the tablet is rooted, you can install the SDFix application from Google Play.

Once installed, launch SDFix. The application itself is like an installer on Windows, just click yourself through.

After you see the green "Complete" page, you must reboot your tablet. Otherwise the applications still can't write into the SD.

5. Create file or folder with File Explorer in SDCardTo test both console and application permissions, I first created a folder "Movies" in /storage/sdcard1 in the "Terminal Emular" as root: