DataOnSD
Introduction
This is a hack to allow the second partition of an SD card to be used as data storage space on an Android phone. The original idea is from JVene as discussed in this thread:
http://androidforums.com/threads/proposal-theory-for-external-sd-storage-solution-on-f6.819792/
The current implementation has evolved from the original proposal. For more information, please check the original thread.
Disclaimer
No one but you is responsible for what you do to your device. There is no guarantee of any kind whatsoever that any files would work as claimed. There is no guarantee of any kind whatsoever that any information would even be safe to apply. Proceed at your own risk!
Prerequisites
Installation
Usage Notes
Files
Introduction
This is a hack to allow the second partition of an SD card to be used as data storage space on an Android phone. The original idea is from JVene as discussed in this thread:
http://androidforums.com/threads/proposal-theory-for-external-sd-storage-solution-on-f6.819792/
The current implementation has evolved from the original proposal. For more information, please check the original thread.
Disclaimer
No one but you is responsible for what you do to your device. There is no guarantee of any kind whatsoever that any files would work as claimed. There is no guarantee of any kind whatsoever that any information would even be safe to apply. Proceed at your own risk!
Prerequisites
- Capable microSD card (with fast random reading and writing like Samsung or SanDisk)
- Custom recovery to install flashable zips (either CWM or TWRP for Jelly Bean roms, TWRP for KitKat roms)
- Functional rom/system (set up device before applying the hack)
Back up your files and data before making changes!
Root
To install a custom recovery, we first need to root the phone.
See this thread for more info:
http://androidforums.com/threads/guide-rooting-the-optimus-f6-and-recovery.823131/
You can uninstall tr.apk afterwards if you wish. Once you're rooted, the apk itself isn't needed.
You can optionally install BusyBox if you wish. Some root apps require it, but it is not needed by this hack except the init.d version. Most if not all roms that support init.d also have BusyBox already built-in.
Root is needed to install custom recovery. Custom recovery is used to install the hack. Usage of the hack should not require root, so if desired, it should be possible to unroot after the hack is installed and functioning.
Recovery
For recovery, install hroark13's TWRP:
http://androidforums.com/threads/recovery-twrp-lokied-new-apk-version-08-27-14.861281/
Install the apk. Open app. Install recovery. (BusyBox might be needed for this.)
You can keep the app to reboot to recovery or you can install a different one like GameTheory's app.
Functional rom
Set up the rom as you wish. When you install the hack, all files in the internal /data folder (apps, settings, etc.) will be copied to the SD.
If you want to use a new rom, flash it first. Reboot into the system to set up the rom. Then go back into recovery without triggering factory reset and install the hack.
Root
To install a custom recovery, we first need to root the phone.
See this thread for more info:
http://androidforums.com/threads/guide-rooting-the-optimus-f6-and-recovery.823131/
You can uninstall tr.apk afterwards if you wish. Once you're rooted, the apk itself isn't needed.
You can optionally install BusyBox if you wish. Some root apps require it, but it is not needed by this hack except the init.d version. Most if not all roms that support init.d also have BusyBox already built-in.
Root is needed to install custom recovery. Custom recovery is used to install the hack. Usage of the hack should not require root, so if desired, it should be possible to unroot after the hack is installed and functioning.
Recovery
For recovery, install hroark13's TWRP:
http://androidforums.com/threads/recovery-twrp-lokied-new-apk-version-08-27-14.861281/
Install the apk. Open app. Install recovery. (BusyBox might be needed for this.)
You can keep the app to reboot to recovery or you can install a different one like GameTheory's app.
Functional rom
Set up the rom as you wish. When you install the hack, all files in the internal /data folder (apps, settings, etc.) will be copied to the SD.
If you want to use a new rom, flash it first. Reboot into the system to set up the rom. Then go back into recovery without triggering factory reset and install the hack.
Installation
- Partition the SD card: 1st partition=fat32, 2nd=ext4.
- Boot into recovery without triggering data wipe.
- Flash the appropriate zip file(s).
- If rom has init.d support and BusyBox, you can try DataOnSD-initd.zip (but this is not as well tested/supported).
- Otherwise, flash DataOnSD-copy.zip and then DataOnSD-install.zip.
- If rom has init.d support and BusyBox, you can try DataOnSD-initd.zip (but this is not as well tested/supported).
- Reboot into system and determine whether additional workarounds are necessary.
Back up your files and data before making changes!
Partitioning and formatting
There are many ways to partition the card. On a Windows PC, you can use MiniTool Partition Manager. On the phone, there are apps like AParted. Remember to align partitions at least to MB to avoid misalignment causing poor performance and shortened lifespan. After the SD card is set up, copy the necessary files to the card.
I also provide DataOnSD-partition-NN.zip that can be used in recovery. If you decide to use it instead, read the info associated with the zip. Once you're in recovery, install the renamed DataOnSD-partition-NN.zip before installing DataOnSD-copy.zip.
Booting recovery
Do not use volume down + power on the F6 to reboot into recovery. Use a method that does not trigger a factory reset on this phone: TWRP app's reboot function, reboot app (e.g. GameTheory's app), custom rom's advanced reboot option, "reboot recovery" at a command prompt, or "adb reboot recovery" with ADB.
Once in recovery, it's highly recommended that you make a full backup before making system changes.
Wiping external partition
If you've just partitioned and formatted the SD card, this step is not necessary. However, if the ext4 partition on the SD is not empty, wipe it first.
Settings -> check "use rm -rf..." -> back to main screen -> Wipe -> Advanced Wipe -> check only "sd-ext" -> swipe to wipe -> back to main screen -> Settings -> uncheck "use rm -rf..." -> back to main.
Flashing zips
Install -> find location of your zip files -> select DataOnSD-copy.zip -> swipe to flash -> wait for file copying to finish and make sure no errors -> back -> select DataOnSD-install.zip -> swipe to flash -> Reboot System.
Checking functionality
Space: Obviously, if the hack works, your storage space should now be the size of your external ext4 partition.
Sensors: If they don't work, auto-rotate doesn't work. So if you have a problem with sensors, wait a couple of minutes to let the phone settle down after boot. Then reboot and check again. If the sensors still don't work, you need to apply the sensor workaround.
KK SD permission: If you're running a KitKat rom, download and install a new file manager that wasn't installed to the internal storage. If you can't or don't want to access the Play Store, you can try Total Commander: http://www.ghisler.com/android.htm
Without giving superuser privileges to the file manager, try to create a file or folder in the emulated SD. If that fails, you need to apply the KK-permission workaround.
Applying workarounds
Reboot to recovery and flash the appropriate zip: -sensorfix.zip for sensor workaround only, -kksdfix.zip for KK-permission workaround only, or -sensor-kksdfix.zip for both.
Partitioning and formatting
There are many ways to partition the card. On a Windows PC, you can use MiniTool Partition Manager. On the phone, there are apps like AParted. Remember to align partitions at least to MB to avoid misalignment causing poor performance and shortened lifespan. After the SD card is set up, copy the necessary files to the card.
I also provide DataOnSD-partition-NN.zip that can be used in recovery. If you decide to use it instead, read the info associated with the zip. Once you're in recovery, install the renamed DataOnSD-partition-NN.zip before installing DataOnSD-copy.zip.
Booting recovery
Do not use volume down + power on the F6 to reboot into recovery. Use a method that does not trigger a factory reset on this phone: TWRP app's reboot function, reboot app (e.g. GameTheory's app), custom rom's advanced reboot option, "reboot recovery" at a command prompt, or "adb reboot recovery" with ADB.
Once in recovery, it's highly recommended that you make a full backup before making system changes.
Wiping external partition
If you've just partitioned and formatted the SD card, this step is not necessary. However, if the ext4 partition on the SD is not empty, wipe it first.
Settings -> check "use rm -rf..." -> back to main screen -> Wipe -> Advanced Wipe -> check only "sd-ext" -> swipe to wipe -> back to main screen -> Settings -> uncheck "use rm -rf..." -> back to main.
Flashing zips
Install -> find location of your zip files -> select DataOnSD-copy.zip -> swipe to flash -> wait for file copying to finish and make sure no errors -> back -> select DataOnSD-install.zip -> swipe to flash -> Reboot System.
Checking functionality
Space: Obviously, if the hack works, your storage space should now be the size of your external ext4 partition.
Sensors: If they don't work, auto-rotate doesn't work. So if you have a problem with sensors, wait a couple of minutes to let the phone settle down after boot. Then reboot and check again. If the sensors still don't work, you need to apply the sensor workaround.
KK SD permission: If you're running a KitKat rom, download and install a new file manager that wasn't installed to the internal storage. If you can't or don't want to access the Play Store, you can try Total Commander: http://www.ghisler.com/android.htm
Without giving superuser privileges to the file manager, try to create a file or folder in the emulated SD. If that fails, you need to apply the KK-permission workaround.
Applying workarounds
Reboot to recovery and flash the appropriate zip: -sensorfix.zip for sensor workaround only, -kksdfix.zip for KK-permission workaround only, or -sensor-kksdfix.zip for both.
Usage Notes
- You need an SD card with adequate random read/write performance because the OS will be reading from and writing to the SD card frequently.
- This hack uses the ext4 partition on the SD card as the /data partition. Do not remove the SD card from the phone while the phone is on.
- Android's data encryption feature isn't supported. Since all of your user data is on the removable SD card, beware of the security implication.
- The /data partition in the internal storage should remain intact and hidden. If the hack is not active (e.g. hack is disabled, partition fails to mount, or SD card is removed), the phone should still boot using data from the internal storage.
- Sometimes the ext4 partition on the SD card fails to mount (because of forced reboot/shutdown, file system error, bad flash memory cell, etc.) and the phone boots with the internal /data storage instead. Reboot into recovery and flash -fsck-ondemand.zip to attempt to fix the partition.
- Some roms require additional workarounds. Flash the appropriate zips in recovery to use them if necessary.
- Some settings (e.g. USB debugging) are read and applied by Android before the hack is activated during boot-up. Changes to those settings get written to the SD card, but Android reads the values from the internal storage on next boot. To make those settings persistent, uninstall the hack, change the settings, and reinstall the hack/workaround (no need to copy).
Files
- Universal version (updated 4/02/2015)
- -copy.zip
- -install.zip
- -uninstall.zip
- Init.d version (#319 of original thread)
- -initd.zip
- Workarounds (updated 4/17/2015)
- -sensorfix.zip
- -kksdfix.zip
- -sensor-kksdfix.zip
- Maintenance tools (updated 4/17/2015)
- -fsck-ondemand.zip
- -wipe-dalvik.zip
- Helper tool (updated 6/07/2015)
- -partition-NN.zip
- Basic backup/restore (#460 and #476 of original thread)
- -backup.zip
- -restore.zip
- JVene for the original idea and technical info.
- crm701 for testing and feedback, especially KK testing.
- stigmax2 for testing and feedback to help get it working in TWRP.
- likwid2, Lhy19, and bigfuzzymonster for ideas about sensor workaround.
- RelZeshi and orion2323 for reporting KK permission issue and helping test workaround.
- TrevorX5J9 for reporting and helping diagnose mounting issue caused by file system errors.
- Krlypumaa for reporting issue with Dalvik wiper and testing a fix.
- GameTheory for tips to package installation script into flashable zip.
- Everyone who has tried, tested, used, and/or provided feedback for this hack.
- Everyone who has contributed to the original thread.
- Anyone else I forget, please remind me.
Last edited: