yashsingh1/xdaforums huggingface dataset:
[HTC Vox] h4waii:
Yes, heed the above advice. If you are WM6.0 and upgrading to 6.1 - make a complete and self-extracting backup using Sprite Backup. If you decide you don't like WM6.1, drop back to your original ROM and you can restore your backup to exactly how it was prior to your upgrade.

You can merge specific data from 6.0 to 6.1 however registry entries will not come over properly - which means all you can really restore are SMS and PIM.
[HTC Vox] h4waii:
EDIT: Double Post
[HTC Vox] jockyw2001:
This can be done by means enabling the r2sd function in the SPL. Unfortunately this is not really user friendly :D
[HTC Vox] andip71:
Many thanks

Hello,

I am overwhelmed of that many answers and just say a big thank you to all who answered.

Will give SpriteBackup a serious try now, maybe also try the "user unfriendly" r2sd function afterwards.

Many many thanks for you, really making this forum a great platform!

BR

Andi
[Fire TV Android Development] Pretoriano80:
Warning !!! Use this module on your own risk !!! I can't be held responsible for any kind of damage or data loss !!!

Version 1.3 and higher requires my custom kernel 6.2.7.1_v3 or higher + Selinux magisk module from the kernel thread

Magisk 20.3 recommended

This module will add NTFS/F2FS/EXT4/exFAT read/write support to USB OTG.This means that the usb storage (usb stricks,external hard-drives,etc) will be mounted automatically

if one of the supported filesystem is detected.

**Note: F2FS support require a custom kernel,with F2FS support enabled** --> custom kernel thread

The module will also set external write permission for Kodi (this was required because Kodi doesn't support such permission or the request for it)

It also enables sys_fs read permission for Kodi, so it can read the CPU temperature without root permission.

Note 2: This was tested with Magisk v20,so i highly recommend you to use that version or higher !

Note 3: Some EXT4 drives may fail to mount,most likely this is because e2fsck it's failing to check for errors. In the next version i will try to add a newer version of e2fsck.However, formatting to EXT4 directly on the device will fix the issue.

Installation :

Install the module with Magisk Manager or TWRP

Reboot and insert the usb drive

Changelog

v1.0 - Initial release

v1.1 - Possible fix for the mount/unmount loop

v1.2 - Added custom kernel detection (with exFAT support) and updated some of the exFAT binaries

v1.3 - This version requires my custom kernel 6.2.7.1_v3 or higher + Selinux magisk module from the kernel thread

v1.4 - Major rework of the module ,now it workes with all Magisk 20.3 + version (tested up to 21.0 and canary builds)

v1.4.1 - Fixed binaries execute permission

VOLD sources - > Github
[Fire TV Android Development] TitanUranus:
Thanks, much appreciated & I will try this soon. Maybe flashing with TWRP is a better idea as flashing modules through Magisk is known to cause problems.
[Fire TV Android Development] DarkH2O:
So after following the steps in the topic to unlock and root, install Magisk first an then you package?

I tried to install you package with TWRP but it failed with an error.

---------- Post added at 01:22 AM ---------- Previous post was at 12:51 AM ----------

It installed after adding Magisk but when playing video from the harddrive it has an unexpected error and the drive seems to unmount and then remount.
[Fire TV Android Development] MrHomebrew:
Installed fine in magisk, just not supposed to update magisk itself in magisk, that you do in twrp. Magisk models themselves should be ok
[Fire TV Android Development] Pretoriano80:
What kind of hard-drive you are using, it has external power? And what filesystem?
[Fire TV Android Development] DarkH2O:
NTFS, Its a WD Easystore and it does not have external power.
[Fire TV Android Development] Pretoriano80:
Probably that's the issue, i don't think the power supplied thru the FireTV charger is enough.

I only tested on a hard-drive with external power.
[Fire TV Android Development] DarkH2O:
Do you think a powered usb hub could help with that?
[Fire TV Android Development] Pretoriano80:
It might, but never tested personally. I'm planning to buy such a hub too.
[Fire TV Android Development] MrHomebrew:
Will there be a way to transfer/move or install apks to the external storage?
[Fire TV Android Development] MrHomebrew:
Not sure if it is working and mounting 100%. Might need some work, was able to link apps to usb but seems like some errors can cause the usb to amount at times. Good start for sure, hopefully you can get this working 100% when moving apps to the usb.
[Fire TV Android Development] Pretoriano80:
What do you mean with "link apps to usb"? That won't work and it's not recommended to use an OTG device as adoptable storage storage.

What kind of device you are using as OTG storage and the filesystem?!

Amazon modified the Android framework heavily, so adoptable storage it's a no go for now, to much hassle to spend time on that,a custom rom would a better solution.

However, without logs, it's hard to understand the reason why the drive disconnects/unmounts, it could be a power failure, corrupted fs or simply the unstable exfat/ntfs driver.
[Fire TV Android Development] Pretoriano80:
I managed to reproduce the unmounting/mounting issue with an EXT4 USB stick.

The are I/O Buffer issues, so i will have to investigate if this issue is caused by vold or something else.

Edit: OP udated with a new version,please test it and report back!
[Fire TV Android Development] MrHomebrew:
I'm not using it as adoptable storage, just able to move apk data to the usb drive and still load the apk. Seems like the usb drive would keep connecting and reconnecting.

Seems like you are aware of the connect/disconnect loop. If I'm not mistaken I am running exfat most likely.
[Fire TV Android Development] MrHomebrew:
Look your recent update is working better. Keep up the great work, all apk data is on the usb drive right now and loaded correctly on your latest
[Fire TV Android Development] MrHomebrew:
Once in a wile it messes up a bit, seems like heavy use can cause the usb to unmount
[Fire TV Android Development] Pretoriano80:
That's why i pushed the new version, to fix that particular issue.

I've tested the new version with an USB Stick (ext4) and 2 external hard-drives (with external power supply) which have multiple EXT4 and NTFS partitions.I've tested them roughly, let them play two full movies and none of them failed (even if there was simultaneous read-write on them).

exFAT it's unstable and it was unstable with my initial testing too, probably less when i'm using my custom kernel with exfat (non-fuse) support.

There's a reason why it's still "staging" in linux kernel, i guess.
[Fire TV Android Development] Pretoriano80:
Have you tried the new version? If you do, please let me know if that hard disk works now!
[Fire TV Android Development] enestu:
Tried on tank : It stuck on FireTV logo how to remove (or zip to remove) ?
[Fire TV Android Development] Pretoriano80:
It's for AFTV 4k (mantis) only, not for tank!

Reboot to TWRP and from Advanced -Terminal use this command :

rm - r /data/adb/modules/aftvotg

Then reboot to FireOS.
[Fire TV Android Development] nomobytes:
As you probably know, adoptable storage has been implemented in Fire TV Edition TVs (blanche) and is exposed in the gui where a usb stick (connected with/or without a hub) can be configured as adoptable storage

---

As you also probably know, Fire TV 3rd Gen (needle) and 4KStick (mantis) can be configured to support adoptable storage using the sm command -

mantis:/system/bin $ sm
usage: sm list-disks [adoptable]
sm list-volumes [public|private|emulated|all]
sm has-adoptable
sm get-primary-storage-uuid
sm set-force-adoptable [true|false]

sm partition DISK [public|private|mixed] [ratio]
sm mount VOLUME
sm unmount VOLUME
sm format VOLUME
sm benchmark VOLUME

sm forget [UUID|all]

sm set-emulate-fbe [true|false]

As follows -

mantis:/system/bin $ sm list-disks
disk:8,0
mantis:/system/bin $ sm partition disk:8,0 private

Resulting with-

mantis:/system/bin $ sm list-volumes
emulated:8,2 unmounted null
private mounted null
emulated mounted null
private:8,2 mounted cd326e5e-fd8a-4bd4-8bda-b41ebd2263ec

And -

mantis:/system/bin # cat /proc/partitions
major minor #blocks name

7 0 10240 loop0
254 0 383024 zram0
179 0 7634944 mmcblk0
179 1 1024 mmcblk0p1
179 2 5120 mmcblk0p2
179 3 5120 mmcblk0p3
179 4 16384 mmcblk0p4
179 5 16384 mmcblk0p5
179 6 3584 mmcblk0p6
179 7 1024 mmcblk0p7
179 8 1024 mmcblk0p8
179 9 1024 mmcblk0p9
179 10 153600 mmcblk0p10
179 11 1126400 mmcblk0p11
179 12 524288 mmcblk0p12
179 13 5779439 mmcblk0p13
179 96 512 mmcblk0rpmb
179 64 4096 mmcblk0boot1
179 32 4096 mmcblk0boot0
8 0 62521344 sda
8 1 16384 sda1
8 2 62503919 sda2
253 0 62503919 dm-0

Resulting in-

mantis:/system/bin # mount |grep expand
/dev/block/dm-0 on /mnt/expand/cd326e5e-fd8a-4bd4-8bda-b41ebd2263ec type ext4 (rw,dirsync,seclabel,nosuid,nodev,noatime,block_vali
dity,delalloc,barrier,user_xattr)

You must manually move an app to adoptable storage-

pm move-package PACKAGE [internal|UUID]

where the UUID can be grabbed from the sm command

---

Note-1: Apps will be moved to /mnt/expand/[UUID]/app, and app data will be moved to /mnt/expand/[UUID]/user/0

Note-2: Requires shell and can be performed on a non-rooted device using adb or a remote adb app

https://play.google.com/store/apps/details?id=com.cgutman.androidremotedebugger&hl=en_US
[Fire TV Android Development] Pretoriano80:
[MENTION=8454221]nomobytes[/MENTION] yeah, i knew about this stuff, but it's for advanced users, so that's why i never said anything about it in here.

I did tried to find a way to enable adoptable storage directly in Settings, but after spending a lot (read to much) time looking thru Amazon's framework and apk, i dropped the ball on it.

Even if i would've succeed, most likely that kind of stuff would require a re-work when a new OTA drops.

Probably i will test the adoptable storage one of these days, but for now a 64GB F2FS external storage it's running great, at least for my use (mostly Kodi and such).

How are things working for you with adoptable storage, any issue so far or it's pretty stable?
[Fire TV Android Development] CrazyIvan:
Does this work without unlocking/root?
[Fire TV Android Development] CrazyIvan:
Sorry for the already answered question. Just tried it on my stock 4k stick and it seems to work. Running Kodi off a USB stick. This will work great for using Kodi for games with the Internet Game Launcher add-on as all the ROMs should now go on the USB stick.

Note for other noobs, use "pm list packages" to find the package name of the app you want to make adoptable.
[Fire TV Android Development] nomobytes:
It's relatively stable, but doesn't have the bells and whistles to format, eject, and move apps back and forth from internal to USB storage, as can be found in the Fire TV Edition units.

Also note that OTA updates of an app that has been moved to adoptable storage will fail, unless the app supports installation to external storage as specified in the manifest header- installLocation="0"

OTA system updates are not expected to break adoptable storage as Amazon must support this scheme in their integrated TVs.
[Fire TV Android Development] Pretoriano80:
Yep, that's what i was trying to achieve on mantis, but adoptable storage support it's "half baked" on this device.

I wonder if there's a full blanche rom available,it would be helpful to compare some stuff against mantis's.

Have you tried to force install location on external with "pm set-install-location"? That should override the manifest.
[Fire TV Android Development] MrHomebrew:
I've given this a try and noticing some very slow speeds running RetroArch or Kodi from a usb drive.

For those who have it working well what type and size usb stick are you using?
[Fire TV Android Development] Pretoriano80:
I'm using a 64GB F2FS formatted microSD and i can't complain.

External hard drive was also quite good in terms of performance.

However, don't expect an OTG drive to perform like the internal storage, it won't, not even close.

That's also one of the reasons why i said that adoptable storage it's not really a good solution, not on this device at least.
[Fire TV Android Development] CrazyIvan:
Kodi ran fine watching Network videos from my Kingston 64GB DataTraveller. I didn't see any speed difference vs. internal. I did this on a stock Firestick4K though. I believe it gets formatted by FireOS as Ext4. Whatever it is my Windows 10 machine cannot read the DataTraveller.
[Fire TV Android Development] gherbert:
Running here with Samsung 1TB USB hard drive. Works very well with Kodi. Now I just need to figure out one method to transfer movies from my phone to FireTV.
[Fire TV Android Development] DarkH2O:
I still get disconnects after a minute or so. It probably is a lake of power to run this external HD. I even get clicking sounds sometimes.
[Fire TV Android Development] cristimnt:
Hello,

I've successfully flashed this module and my 8GB USB drive is recognized. However my torrenting app cannot write anything on the USB drive. How can I grant write permissions on USB OTG for an app?
[Fire TV Android Development] Pretoriano80:
The app should require permissions when is trying to write to the external storage.If it doesn't, it means that it doesn't support the external storage write permission.(same problem Kodi has).

Best solution would be if the app developer implement this access permission, otherwise you would need to modify the /data/system/packages.xml and add this:

<item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" />

in your torrenting app permissions section.
[Fire TV Android Development] cristimnt:
I've added <item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" /> to packages.xml at the app section but it did not work and did not survive a reboot. Any tips to have the line permanent written?
[Fire TV Android Development] Pretoriano80:
Check my Magisk module, i used the same workaround for Kodi. You could add your app permission directly into the module the same way i did for Kodi and then install it again.

Extract the module and check /common/post-fs-data.sh file.

Edit: Or you could pull the file from the device, modify it and then use twrp's file manager to push it back to the device. This way the changes should stay.
[Fire TV Android Development] CrazyIvan:
Did you see post #21 in this thread?
[Fire TV Android Development] Pretoriano80:
deleted
[Fire TV Android Development] cristimnt:
Used the second method, pulling the file-edit-putting it back and it worked. Thanks for this!

Now I get usb disconnects when it is hdmi plugged in the tv. Working fine when unplugged. Using original power supply. OTG cable could be faulty?

Also, how can I f2fs format the USB drive directly on the stick to exclude exfat problems?

Edit: Managed to f2f2 format the usb stick and used the adoptable storage storage method and I have not observed any disconnections.

Now it mounts everytime to /mnt/expand/55c0a4e7-b533-478c-82c2-4c2b456bcb26.

Torrent app still cannot write to this mount point, even if WRITE_MEDIA_STORAGE is present in packages.xml.
[Fire TV Android Development] Pretoriano80:
If you used the adoptable method, then probably the external stick was formatted to EXT4.

Stock kernel doesn't support F2FS, so you can format it to f2fs (using the f2fs tools that are installed with my module) but it won't be possible to mount it.

Try another torrent app, it's odd that it can't write even with adoptable.
[Fire TV Android Development] rocker0:
very helpful indeed...
[Fire TV Android Development] cristimnt:
Ufff. Installed another app, modified packages.xml for write perm. and now it is stuck on boot on fire tv screen. Tried to reflash the module but it did not help. Any suggestion to get out of the bootloop without rom reflashing?
[Fire TV Android Development] Pretoriano80:
You can delete Magisk's modules from /data/adb/modules with twrp's file manager.

If it bootloops after you modified the packages.xml file, then it might be a permissions issue. Replacing the file with the original one might also help.
[Fire TV Android Development] cristimnt:
Should be permissions. Stupid me modified packages.xml perm to 0700 in twrp. What should it be?
[Fire TV Android Development] Pretoriano80:
Permission should be "0660" and owner:group should be "1000:1000"
[Fire TV Android Development] cristimnt:
Deleted the module and changed permissions:

-rw-rw---- 1 system system 747975 Nov 8 2019 /data/system/packages.xml

Is this correct? Still stuck at firetv logo :(

Edit: nevermind, I deleted packages.xml and it booted. My settings are gone but at least I don't have to reflash. Sorry for being clumsy.
[Fire TV Android Development] cristimnt:
Ok, so far I tried 4 torrent apps and neither could write to OTG stick (mounted as adoptable storage to /mnt/expand/UUID), even with WRITE_MEDIA_STORAGE granted.

Should I give up to adoptable storage and try again with this module? Any other tips?
[Fire TV Android Development] Pretoriano80:
I don't know, i'm not using adoptable storage. However, you could try to set the download path to /Android/data/package.name/
[Fire TV Android Development] cristimnt:
I made it!

For those trying to achieve the same on adoptable storage. Torrent app used is BiglyBT.

/mnt/expand/55c0a4e7-b533-478c-82c2-4c2b456bcb26/ is my OTG drive

pm move-package com.biglybt.android.client 55c0a4e7-b533-478c-82c2-4c2b456bcb26

And now you can set the download path to /mnt/expand/55c0a4e7-b533-478c-82c2-4c2b456bcb26/user/0/com.biglybt.android.client/

This way you can download directly to the OTG drive.

Now mxplayer does not play my video from adoptable storage. Read permissions?
[Fire TV Android Development] cristimnt:
So it seems that I have to use bindfs to fake the permissions to be able to read/write the adoptable storage with any app. Can some of you guys help with this? I was not able to find a compiled bindfs that works on this stick and I don't have the necessary resources to compile one.

Full permissions on the OTG drive would be a great feature to have. Thanks nomobytes and Pretoriano80 for your efforts!
[Fire TV Android Development] Pretoriano80:
Maybe i will try adoptable these days, but i have no idea why you have these permission issues, it should work just as the internal storage (regarding permissions).

Have you tried to use adoptable with and without my module installed?
[Fire TV Android Development] cristimnt:
I have tried both, with and without your module without success.

Here you can read how adoptable storage works: https://android.stackexchange.com/questions/217741/how-to-bind-mount-a-folder-inside-sdcard-with-correct-permissions
[Fire TV Android Development] DarkH2O:
I finally got around to getting a powered usb hub and yes it helped with the portable hard drive issue. Now since the firestick is no longer trying to power the drive, it no longer disconnects. This is a usb 3.0 powered hub. That may matter when it comes to providing the power needed.
[Fire TV Android Development] Pretoriano80:
Yes, USB 3.0 matters and iirc your drive is designed to work with USB 3.0,which is able to provide more power. My tests were also made with an external USB3.0 hard drive dock.

These gadgets (FireTVs) are not designed to provide the necessary power for external hard drives.

These days i will try to modify vold for the use with a custom kernel which has exFAT support, so it won't use FUSE to mount exFAT. This should improve speed and stability on exFAT drives.
[Fire TV Android Development] Pretoriano80:
Well, is not really how adoptable works, that's how half implementation works. xD

When Adoptable Storage it's implemented in a rom/firmware, you don't have to mess with bind, symlinking and such stuff and iirc, once you choose to use an external storage (mostly sdcards, because it was not really designed for otg) as adoptable, then apps data will be moved to the adoptable storage.

However i tested adoptable on FireTV 4k and managed to fix the issue you have with the apps not being able to access the expanded storage.

You will have to mount bind /mnt/expand/UUID/media/0 to a folder on /storage/emulated/0

Best way would be to use a Magisk module which will do that on boot.

Here's an example :

1) Make a directory called "adoptable" in your internal storage

2) mount - o bind /mnt/expand/UUID/media/0 /storage/emulated/0/adoptable

That should be enough and the apps should be able to read/write on the adoptable storage.
[Fire TV Android Development] cristimnt:
Last night I achieved the same with fbind. However it is not fully functional. Only Kodi can access correctly the binding. Maybe because of your module which enables external storage permissions?

What magisk module have you used?

Edit: this is my syntax: bind_mount /mnt/expand/55c0a4e7-b533-478c-82c2-4c2b456bcb26/user/0/com.biglybt.android.client /mnt/runtime/default/emulated/0/mov

Even with root browser and terminal emulator /sdcard/mov is empty but if i browse with kodi to /default/emulated/0/mov I can playe the movies.

Browsing with terminal to /mnt/runtime/default/emulated/0/mov can see the binding correctly.
[Fire TV Android Development] Pretoriano80:
You shouldn't mount like that. Try with :

mount -o bind /mnt/expand/55c0a4e7-b533-478c-82c2-4c2b456bcb26/media/0 /data/media/0/mov

Then, with the torrent app, create a folder in /mov (mov/downloads). But probably the /downloads folder will be accessible only to the torrent app.

Instead /sdcard/mov should be accessible to other apps too.

I didn't used any Magisk module, but i just did one and it has some issues binding on boot, probably a timing issue, because if i run the script manually, after boot, then it works just fine.

Edit: Still not managed to make it work as it should! Back to portable mode it is! xD
[Fire TV Android Development] cristimnt:
Yeah, it looks like it is difficult to manage this adoptable storage. Any news about that modified kernel for ext4?
[Fire TV Android Development] Pretoriano80:
You could format the external storage as "mixed", adoptable and portable. This way you could move apps to adoptable and use the portable partition to store app"s data (movies, documents, etc).

Already testing this combo with portable formatted as F2FS and so far it's working good with my very slow testing sdcard, the custom kernel and SDCARDFS enabled (the latter should improve I/O operations a bit).

Yes, the kernel was ready, but i wanted to fix the issues i had with some writing permissions when SDCARDFS was enabled and today i succeed, so now i have to prepare the sources and polish the Magisk module (probably i will make a second version, to be used with the custom kernel).

If you want to test it, send me a PM!
[Fire TV Android Development] Pretoriano80:
New version added to OP. Kernel also released, you will find the link for it in the OP too.

Beware that the kernel is based on 6.2.6.8 sources.

If you are using a flash memory (sdcard, USB stick, ssd, etc) i highly recommend using F2FS, is performing much better than the other filesystems.SDCARDFS should also help, performance wise.

Note; SDCARDFS is not a filesystem as ext4, f2fs, etc, read about it on Google!
[Fire TV Android Development] cristimnt:
I managed to install the custom kernel and v1.2 of this module. I formatted the USB drive to f2fs and I am able to read files with any app but torrenting app cannot write to usb drive. Do I still need to bind or do any other setting?

These are the mount points for the stick:

/mnt/media_rw/0a820a82-1164-4d03-aec8-85de1fc1a818

/mnt/runtime/default/0a820a82-1164-4d03-aec8-85de1fc1a818

/mnt/runtime/read/0a820a82-1164-4d03-aec8-85de1fc1a818

/storage/0a820a82-1164-4d03-aec8-85de1fc1a818

/mnt/runtime/write/0a820a82-1164-4d03-aec8-85de1fc1a818

None of them are writable by the torrenting app.

Edit: Solved. <item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" /> is still needed in packages.xml