HOWTO: Move Kodi's data to external memory on an Amazon Fire TV
#31
About 5 months ago I moved my Kodi app and data to the 2ndary chip on my FireTV (not USB, that won't work). It solved all my Kodi performance issues.
Recently I started getting the familiar FireTV "low on storage" and "remove apps" message. And, Kodi began behaving erratically again (black background with only a few lines of icons, exit doesn't work, need to visit settings: stop application, delete cache, launch application).
I had NO apps installed on the main storage except Amazon non-removable apps.
So I installed a disk usage app:
https://apkpure.com/diskusage/com.google...d/3083-APK
...which showed me that Amazon's TV Launcher was the data hog, taking up 1.5gb for data.
I ran the following command: 
adb shell pm clear com.amazon.tv.launcher, and then rebooted the FireTV.
This reduced TV Launcher data usage to 125mb, solving once more all my limited space Kodi performance issues (I now have 2.0GB of free space on my FireTV).

Hope this helps others.
Reply
#32
(2016-02-06, 22:56)hurlbert Wrote: HOWTO: Move Kodi's data to external memory on an Amazon Fire TV

An updated HOWTO would be awesome! 

(And my apologies if I should not be "bumping" a thread from 2016? Just hoping hurlbert might still be active?)
Reply
#33
(2016-02-06, 22:56)hurlbert Wrote:
(2016-02-06, 11:25)Koying Wrote: Yeah, sorry about that, not our fault, really.
I've started digging into the Android api, but it really, really does not fit a native, cross-platform, app as Kodi.

Thanks for the detailed explanation. If you make a new thread with a "howto" (basically the post above with a bit of context), I'll stick it.

HOWTO: Move Kodi's data to external memory on an Amazon Fire TV

Short version for the Amazon Fire TV (AFTV):
 
  • Create a file on your AFTV called, "/mnt/sdcard/xbmc_env.properties"
  • xbmc_env.properties contains one line to tell Kodi where you're data is located
  • This line should read: xbmc.data=/usbdisk/Android/data/org.xbmc.kodi/files
  • "usbdisk" is the name of a flash drive plugged into the usb port. Verify this location
  • Changes to Android permissions require that the path for Kodi data on your external device be /Android/data/org.xbmc.kodi/files
  • Copy your settings to the USB drive
  • If your settings are on internal storage, copy the contents of: /storage/emulated/0/android/data/org.xbmc.kodi/files to /usbdisk/Android/data/org.xbmc.kodi/files
  • Mount the external storage on your AFTV

Kodi should now load it's library and user settings from your external device.

Long version:

Recent upgrades to Android OS have changed the access premissions of the SD card and USB drives. These changes require your attention when attempting to relocate your Kodi data to secondary storage.
Quote:Note: When the permissions changed the update happened automatically by the device and this cannot be blocked on a Amazon Fire TV without rooting. After the update, Kodi would launch and hang on a blank screen, or launch and then immediately fail. Before the upgrade Kodi had been working flawlessley. The change was very disorienting since an update to the OS had not been requested, but instead pulled by the device.

These instructions were written up based on an Amazon Fire TV running version 5.0.5 of the AFTV OS. They should also offer you enough insight to update other Android devices which will behave similarly once their Android OS has been updated to include these permission changes.

After the permission changes you can only move your data to a place that your application is allowed to write.

To move your data from internal storage to external you must place it in the folder:
 
Code:
/<external_device_name>/Android/data/org.xbmc.kodi/files

Using the USB port and a san disk USB drive on the AFTV, for example, the <external_device_name> is called usbdisk. On that device the files were placed in the folder:
 
Code:
/usbdisk/Android/data/org.xbmc.kodi/files

To move your data, follow these steps.

Create a file called, "xbmc_env.properties", it should have one line in it that tells Kodi where you're data is located.
 
Code:
xbmc.data=/usbdisk/Android/data/org.xbmc.kodi/files

Put "xbmc_env.properties" in the root of your internal storage. On the AFTV this should be /mnt/sdcard so put the file at the following file path:
 
Code:
/mnt/sdcard/xbmc_env.properties

Copied your Kodi data files to new location (/usbdisk/Android/data/org.xbmc.kodi/files). The Kodi data folders start with a period ("."). On the configuration used for these instructions these folders were called:
 
  • .kodi
  • .smb

If you initially install Kodi on internal storage and move these folders to external on the AFTV you will find them at:
 
Code:
/storage/emulated/0/android/data/org.xbmc.kodi/files
 
Quote:Note: Remember that on Android these folders can be mapped to multiple paths. The path above is not the only one to which the folder above has been mapped so if you look around your device you can likely get to the data files multiple ways. Use these instructions as a guide, but your mileage may vary.

Inside the internal data folder for Kodi (/storage/emulated/0/android/data/org.xbmc.kodi/files) you should see folders beginning with a period (".kodi"). These are the folders that should be placed into the folder listed in your "xbmc_env.properties" file.

xbmc_env.properties is detected by Kodi during startup and, if found, Kodi reads it to locate it's data. If this location is incorrect, Kodi will not start or hang will hang on a blank screen. If you don't have an external drive mounted or the path in the xbmc_env.properties file does not exist, Kodi may ignore it and load, but of course it will be using the settings from internal memory. If there are no settings on your internal memory it will create them and use the default settings.

To push the "xbmc_env.properties" to the AFTV, created the "xbmc_env.properties" where adb.exe is located and use these commands. Substitute your devices IP address for xxx.xxx.xxx.xxx (you can find your device's IP address in the settings under network).

Push "xbmc_env.properties" to the Fire TV with these commands:
 
Code:
adb connect xxx.xxx.xxx.xxx
adb push "xbmc_env.properties" "mnt/sdcard/xbmc_env.properties"
adb disconnect

Copy your Kodi data files (.kodi, etc) to your external storage device at the location listed in "xbmc_env.properties" and put the storage device into the AFTV. When you launch Kodi it should find the "xbmc_env.properties", be redirected to use the new data location on your external device, and load.

One advantage of using an external device is that you can easily backup your settings from time to time. To do so, go into Kodi and under "System Settings->Video->Library->Export video library" - this will update the play counts and any edits you've made via the Kodi interface. Whether you use the single file export or separate file export depends on the way you've setup your library. You may want to "Clean library..." before exporting.

After exporting your library, quit out of Kodi, go into the settings and eject the external device, take it to your computer and backup the /Android folder or more specifically the folders at /Android/data/org.xbmc.kodi/files.

Happy watching.

I wanted to seek clarification and ensure I’m following these steps correctly.

I’m using X-Plore for this process.
My external USB drive is named B42A-0A12.

Do I put the “/storage/” in front of it as it shows in X-Plore or just drop that part?

1. On the Firestick, I should go into the path mnt/sdcard.
2. There, I should create a file titled “xbmc_env.properties.”
3. In the file, there should be a line that reads, “xbmc.data=/B42A-0A12/Android/data/org.xbmc.kodi/files”
4. Make sure I have a path on the external device listed as “/Android/data/org.xbmc.kodi/files”
5. Copy all the data in the “Files” folder of my /storage/emulated/0/android/data/org.xbmc.kodi/files (Would I "copy" or "move" the files?
6. Place the data in /B42A-0A12/Android/data/org.xbmc.kodi/files.
7. Then go into ADB Remote Shell. My firestick’s IP Address is already loaded.
8. I would enter “adb push xbmc_env.properties mnt/sdcard/xbmc_env.properties”
9. Then enter “adb disconnect”

Then the process is complete.

Quick Update: I tried multiple variations of the push commands and none of them are working. Is it different if I'm running this on ADB Shell apk on Firestick? I am confident I have everything else correct. :/ Thanks.
Reply
#34
the post you are referencing @davelee77 is quite out of date

/mnt paths are now under sdcard

/sdcard/Android/data/org.xbmc.kodi/files
Reply
#35
Should that still be in the root drive or can I simply place it in the internal storage and then correct the adb command?
Reply
#36
since /mnt/sdcard has changed to /sdcard

/mnt/sdcard/xbmc_env.properties should translate to /sdcard/xbmc_env.properties

the contents should translate xbmc.data=/storage/B42A-0A12/Android/data/org.xbmc.kodi/files

"B42A-0A12" would be specific to your usb drive and not generic to every system


other than specific paths this how-to references this wiki https://kodi.wiki/view/HOW-TO:Change_dat...or_Android


if this still does not work for you i will have time later on to set this up on my own firetv and be able to provide more detailed instructions
Reply
#37
Ok. Thank you. I myself have to step away as well. I'll be back this afternoon to jump back into it and let you know. Thank you very much for your help!
Reply
#38
I've provided images of what I've attempted thus far. These screenshots are only a portion of what I've attempted. I moved the folders and files around in different locations and multiple attempts at entering the correct adb commands to no avail. Please let me know where you see my mistake(s). Thank you.

https://i.postimg.cc/Znh0Q2X7/20230703-134059.jpg

https://i.postimg.cc/wT7nPMcr/20230703-134020.jpg

https://i.postimg.cc/Y2ys1kKz/20230703-134147.jpg

https://i.postimg.cc/3Ny9L45C/20230703-134205.jpg

https://i.postimg.cc/PNsb2SMT/20230703-133941.jpg
Reply
#39
i see, it's not kodi that isn't working, you are using adb incorrectly

this should help -
https://adbshell.com/commands
https://www.xda-developers.com/install-a...acos-linux

-----

you cannot issue "adb" commands inside the adb shell, within the adb shell you are issuing android shell commands to the android shell

the "normal" setup is setting up adb on your computer then push will push files from your computer to android (transfers to android from pc)

conversely, pull will pull from android to your computer
Reply
#40
Ah!!! That makes total sense. Not surprised there. lol just another step in the learning process for me. 😊 I will read up more on this and see if I can get it all squared away!! Thank you again. I'll post back an affirmative response one way or the other on the success in case anyone else comes across these things and needs to guidance from our discussion. I am very grateful for you and the several other folks that have pointed me in all the right directions!! I'll be in touch!
Reply
#41
I have reviewed the info from the link. I see it discussing pc and phone. Am I to assume this is also functional with Firestick. Developer options is already active on it. I'll start by getting things downloaded and set up on PC and phone and then investigate the functionality with the firestick as well. Thanks again. Be back soon!
Reply
#42
Now I get it!! I'll be trying to finish what I started soon. Similar to a CMD Prompt for Windows, this will speak to Android devices. In this case, following the instructions, when I enter the ADB connect with the IP address for the Firestick, that will allow it to link up and enter the commands to push the file xbmc_env.properties. This is FUN! lol I'm going to school in the Fall for IT so I've really enjoyed digging into some of this.
Reply
#43
right on

when using android devices being able to use adb is paramount - apps only do so much plus adb is remote so you're not limited to virtual keyboards

this is quite out of the scope of this forum though, you should browse the xda forums - https://forum.xda-developers.com
Reply
#44
Smile 
Cool. I will do that. I'm running into a snag with this. But guessing I need to post elsewhere? I downloaded the SDK Platform Tools and when I opened the command box it wasn't working. I went back and read and saw I need to set the path first, download Android Studio and a working version of Java? This is gonna be a deep rabbit hole for me but a good one.  😊
Reply
#45
Ok. I'm back. I've gotten further along but still don't believe I'm entering the data correctly but I was able to successfully connect from the laptop to the firestick.

Unfortunately, when I typed in the command, it seemed to send me all the possible commands. Nothing else has happened. Images below. Let me know. Thanks!

Image

Image

Image

Image

Image

Image

Image
Reply

Logout Mark Read Team Forum Stats Members Help
HOWTO: Move Kodi's data to external memory on an Amazon Fire TV2