WarrantyVoider
Android Enthusiast
I was planning to test this release on my phone over the weekend, but the part that needs testing on the phone remains unchanged since my last test and the other part (installation and initialization scripts) was tested on my old Nook Color. So I'm uploading this early. Thanks to GameTheory's tips, I might be able to adapt my script to make a flashable zip without a lot of effort. But that will be later if and when I decide to do that.
Prerequisites:
To make this work, two things are needed -- a way to copy files to the SD card when initially setting up the partition, and a way for the system to mount the partition as /data when the device boots up. If you plan to flash zips via recovery, these two things are done by two separate zips, attached to a later post. If not, use the non-flashable zip attached to this post. Inside the non-flashable zip are three files:
Prerequisites:
- rooted phone. Root is only required to install file(s) to the /system partition.
- Samsung or SanDisk microSD, i.e. card with fast random reading and writing.
- partitioning software to make a fat32 (1st) partition and an ext4 (2nd) partition. Use software that does partition alignment for best results.
- familiarity with some tool that can be used to install this, e.g. file manager, adb, terminal emulator.
- ability to recover from failure in case something goes wrong.
To make this work, two things are needed -- a way to copy files to the SD card when initially setting up the partition, and a way for the system to mount the partition as /data when the device boots up. If you plan to flash zips via recovery, these two things are done by two separate zips, attached to a later post. If not, use the non-flashable zip attached to this post. Inside the non-flashable zip are three files:
- mount_data: binary file that handles mounting of the ext4 partition. This is required at every boot. Failure to install this properly is highly likely to prevent the phone from booting up.
- init_script.sh: shell script that handles file copying from the internal storage to the external SD card. This is only used one time to copy files when setting up the SD card at boot time. Before copying, the script checks for the existence of a file named "LGF6DataOnSD_INIT" in the root directory of the first (fat32) partition on the SD card. If the SD card is already properly set up by using my previous script, this init_script.sh is not needed. It's also not needed if you decide to set up the SD card by copying files from a recovery backup archive.
- installer.sh: shell script for installing in a console. Installation can also be done manually or by a flashable zip, so this is not required.
- Run installer.sh in a console: see post #252.
- Install manually with a file manager: see post #253.
- Use flashable zips: see post #259.
- If you use init_script.sh to copy files at boot time, make an empty file named "LGF6DataOnSD_INIT" in the root directory of the first partition (the fat32 partition) on the SD card. This file tells the script to copy files. It will be deleted before file copying begins.
- If you use the script to copy files at boot time, copying will take a while during the first boot depending on how much data to copy and how fast the SD card is. After files are copied, the phone will reboot by itself. The partition mounting binary will attempt to mount the partition at the second boot. If all is well, the phone should boot up with expanded /data storage.
- The 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.
- As before, the /data partition in the internal storage should remain intact and hidden. To boot with the internal data, power off the phone, remove the SD, and then power on the phone. Reinsert the SD card after boot-up if you need to access data in the fat32 partition. To return to using the external ext4 partition as /data, simply reboot the phone with SD inserted.
- It's possible to change the mount options (e.g. use the noatime flag) in a script after the partition is mounted.
- Some third-party roms support sd-ext, which is the 2nd partition on the SD card, the same as used by this hack. It's possible this causes problems. If so, please report and let me know.
- Mounting is now done by a binary instead of a shell script. This allows me to try to apply the same mount options to the external partition as those used by the internal one.
- Mounting is done by targeting vold instead of app_process. This should load earlier during boot-up so as to avoid interfering with the sensors (accelerometer, compass, magnetic field). This should also be compatible with Xposed.
- After file copying is complete, the phone now reboots. The partition should then be mounted on the next boot-up.