• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root Proposal/Theory for External SD storage solution on F6

One quick question... If (when) this phone gets kit kat... will it still have the storage problem? maybe not the right place to ask. but will see. :)
 
I am just curious.

Has this idea, and program build been abandoned?

It is a great idea since the F6 is an amazing phone for the price, and the increase in the internal memory would greatly improve the F6 experience. I saw Pressy was trying to revive the idea, but that was a while back. Does anyone know if it is actually being implemented, and if so, where to get it? If I do any mods to my phone, I would like it to be this, as well as rooting.
 
I want to thank JVene for his work and confirm that I implemented this successfully. JVene's posts are informative, but long-winded, so here is a TL;DR for people that want to try this. I'm assuming you vaguely know what you're doing (comfortable with linux command line), so I'm not going into extreme detail. Read all the steps first and if it doesn't make sense, I wouldn't recommend trying it as you could mess something up.

1. Partition and format an SD card with a Fat32 partition (1st) and an Ext4 partition (2nd). Choose your size for each. Fat32 will be your new "sd card" and Ext4 will be your new "internal storage".

2. Download and extract the app_process binary that JVene attached to one of his posts.

3. Mount /system read-only ("mount -o remount,rw /system", you need root). Rename your original /system/bin/app_process to something else for backup. Copy JVene's app_process to /system/bin/app_process.

4. Create /system/etc/init.d/zinit.sh (in a nutshell, JVene's modified app_process runs this script before Android initializes) and chmod 755 zinit.sh.

5. Insert "#!/system/bin/sh" as the first line in zinit.sh, then insert your boot-time commands below it. You have several options for your commands, what I personally did was mount the ext4 partition at a temp mount point, copy /data to it, then mount it at /data. This will copy /data to the ext4 partition of the sd card while keeping your original /data partition intact. You can also enable USB debugging beforehand and enter sleep x as your command where x is the number of seconds you want the device suspended prior to loading Android. This will give you time to connect with ADB and manually perform file operations. You could also just mount the new partition at /data and start with a clean slate. The ext4 partition on the sd card is /dev/block/mmcblk1p2, so to mount it at /data: "mount -o rw -t ext4 /dev/block/mmcblk1p2 /data".

6. zinit.sh will be executed during each boot. If you added commands to temporarily mount your sd card partition and copy your current data partition to it, remember to remove them after the first reboot. Your first reboot will also take a fair amount of time at the boot screen as your /data partition is copied. The only command that stays in your zinit.sh file after the first boot is the mount command (unless you want to do more).

How about trying this post to use the ext4 partition for storage
 
Thanks to JVene for all the hard work and info. His posts provided enough details to get the solution working. Also thanks to likwid2 for confirming this method works.

Prerequisites:

  • rooted stock rom. Having stock may not be necessary, but the file JVene provided is built against Android 4.1.2.
  • microSD card with fast random read/write. Use Samsung or SanDisk.
  • some way to partition and format the microSD. Do it on a PC or use one of the available guides to do it on the phone.
  • some way to manage files. Use a file manager or a terminal emulator.
To install:

  1. Get the replacement "app_process".
    • Download JVene's "app_process_4_1_2_r1.gz" (post #16).
    • Uncompress to get "app_process_4_1_2_r1" (size=9572).
  2. Copy "app_process_4_1_2_r1" to the phone's /system/bin directory.
  3. Correct file owner and permissions of "app_process_4_1_2_r1": uid=0 (root), gid=2000 (shell), permissions=755 (-rwxr-xr-x).
  4. Rename the original "app_process" (size=9500) to something else like "app_process-original" and rename "app_process_4_1_2_r1" to "app_process".
  5. Under /system/etc, create subdirectory "init.d" (uid/gid=0, permissions=755, drwxr-xr-x).
  6. Under /system/etc/init.d, either create "zinit.sh" (uid/gid=0, permissions=750, -rwxr-x---) or copy the file there then modify owner/permissions:
    Code:
    #!/system/bin/sh
    
    # NO WARRANTY OF ANY KIND. USE AT YOUR OWN RISK!
    
    # tested on LG MS50012b
    
    PARTITION1="/dev/block/vold/179:33"
    PARTITION2="/dev/block/vold/179:34"
    TMP_DIR="/cache/data_tmp"
    MOUNT_OPT=nosuid,nodev,noauto_da_alloc,resuid=1000,errors=continue
    VALID_TAG=".LGF6DataOnSD_DO_NOT_REMOVE"
    INIT_TAG=".LGF6DataOnSD_INIT"
    
    if [[ -f /data/$VALID_TAG ]]; then
      exit 0
    fi
    if [[ -b $PARTITION2 ]] && [[ ! -d $TMP_DIR ]]; then
      mkdir $TMP_DIR
      mount -t ext4 -o $MOUNT_OPT $PARTITION2 $TMP_DIR
      if [[ "$?" = "0" ]]; then
        if [[ -f $TMP_DIR/$VALID_TAG ]] && [[ -d $TMP_DIR/dalvik-cache ]]; then
          mount -t ext4 -o $MOUNT_OPT $PARTITION2 /data
        else
          mount -t vfat $PARTITION1 $TMP_DIR
          if [[ "$?" = "0" ]]; then
            if [[ -f $TMP_DIR/$INIT_TAG ]]; then
              rm $TMP_DIR/$INIT_TAG
              umount $TMP_DIR
              rm -r $TMP_DIR/*
              rm -r $TMP_DIR/.*
              cp -a /data/. $TMP_DIR
              touch $TMP_DIR/$VALID_TAG
              mount -t ext4 -o $MOUNT_OPT $PARTITION2 /data
            else
              umount $TMP_DIR
            fi
          fi
        fi
        umount $TMP_DIR
      fi
      rmdir $TMP_DIR
    fi
To use:

  1. Create two partitions on SD card. Make the first fat32. It will be external_SD to Android. Some software can resize a partition so you can keep files on an existing fat32 partition. Make the second ext4. It will be Android's /data partition. The order matters. Make sure the ext4 partition is larger than the phone internal storage (duh). Make sure whatever software you use to make partitions is able to properly align them.
  2. In the first fat32 partition, make an empty file ".LGF6DataOnSD_INIT" in the partition's root directory. Normally the first fat32 partition is mounted as /storage/external_SD on the phone. In other words, if you do this step on the phone, create an empty "/storage/external_SD/.LGF6DataOnSD_INIT".
  3. Insert the SD card into the phone if it's not in there already. Then reboot the phone.
First time booting will take a while. The script will copy all files from internal /data storage to the SD card's ext4 partition. Afterwards, the SD's ext4 will become the /data partition. The phone's internal /data partition is hidden and unmodified.

To uninstall:

  1. Remove "/system/etc/init.d/zinit.sh".
  2. Remove "/system/etc/init.d" if the directory is empty.
  3. Remove "/system/bin/app_process" (size=9572) and rename the original file ("/system/bin/app_process-original" in the above example) back to "app_process".
Some notes:

  • Do not remove the SD while the phone is using it as the /data partition.
  • To boot the phone with its internal /data storage, simply remove the SD card (with phone powered off). If you need to access the SD's fat32 partition afterwards, insert the SD after the phone has booted (powered on) with its internal /data. Rebooting the phone with the SD inserted should mount the SD's ext4 as /data again.
  • Don't use CWM or similar to wipe data. I don't know what would happen. Since you can now take out the SD card (with phone powered off), you can wipe (or copy/backup/restore/resize) the SD's ext4 partition on a PC.
  • The script puts an empty file ".LGF6DataOnSD_DO_NOT_REMOVE" in the SD's ext4 partition's root directory. Don't remove it. The script checks it at boot. However, if you want to start over from the state of the phone's internal /data without reformatting, you can remove ".LGF6DataOnSD_DO_NOT_REMOVE" from the ext4 partition (under /data on the phone), create an empty ".LGF6DataOnSD_INIT" on the fat32 partition (under /storage/external_SD on the phone), and reboot. Doing this will erase all files on SD's ext4 partition and copy all files from the phone's internal /data partition to the SD's ext4 partition again.
  • The script has minimal error checking, so it might not mount the SD partition if something goes wrong. However, in that case, the phone should be able to boot up with its internal /data intact.
  • As JVene has said, this method is not compatible with Xposed. To get them to work together, The "app_process" of Xposed will need to be modified to run zinit.sh before Android itself is loaded. This requires editing its source and recompiling.
I hope everything is clear. Good luck.
 

Attachments

From what I am reading so far, it just redirects any data saved by an app that does not ask give you a data path option, unless the app has a predefined directory mapped out in the program code. Like if you were in a browser and saved a pic, if it would normally be saved to internal memory, the module would force the app to send it to a location defined in the memory card, unless the browser had a predefined path written in the code, which this module would then do nothing and the browser would save to internal as normal.

I'm not done reading the entire page yet, but I will update this post according to what I find. If anyone knows better, please let us know.
 
Thanks to JVene for all the hard work and info. His posts provided enough details to get the solution working. Also thanks to likwid2 for confirming this method works.

Prerequisites:

  • rooted stock rom. Having stock may not be necessary, but the file JVene provided is built against Android 4.1.2.
  • microSD card with fast random read/write. Use Samsung or SanDisk.
  • some way to partition and format the microSD. Do it on a PC or use one of the available guides to do it on the phone.
  • some way to manage files. Use a file manager or a terminal emulator.
To install:

  1. Get the replacement "app_process".
    • Download JVene's "app_process_4_1_2_r1.gz" (post #16).
    • Uncompress to get "app_process_4_1_2_r1" (size=9572).
  2. Copy "app_process_4_1_2_r1" to the phone's /system/bin directory.
  3. Correct file owner and permissions of "app_process_4_1_2_r1": uid=0 (root), gid=2000 (shell), permissions=755 (-rwxr-xr-x).
  4. Rename the original "app_process" (size=9500) to something else like "app_process-original" and rename "app_process_4_1_2_r1" to "app_process".
  5. Under /system/etc, create subdirectory "init.d" (uid/gid=0, permissions=755, drwxr-xr-x).
  6. Under /system/etc/init.d, either create "zinit.sh" (uid/gid=0, permissions=750, -rwxr-x---) or copy the file there then modify owner/permissions:
    Code:
    #!/system/bin/sh
    
    # NO WARRANTY OF ANY KIND. USE AT YOUR OWN RISK!
    
    # tested on LG MS50012b
    
    PARTITION1="/dev/block/vold/179:33"
    PARTITION2="/dev/block/vold/179:34"
    TMP_DIR="/cache/data_tmp"
    MOUNT_OPT=nosuid,nodev,noauto_da_alloc,resuid=1000,errors=continue
    VALID_TAG=".LGF6DataOnSD_DO_NOT_REMOVE"
    INIT_TAG=".LGF6DataOnSD_INIT"
    
    if [[ -b $PARTITION2 ]] && [[ ! -d $TMP_DIR ]]; then
      mkdir $TMP_DIR
      mount -t ext4 -o $MOUNT_OPT $PARTITION2 $TMP_DIR
      if [[ "$?" = "0" ]]; then
        if [[ -f $TMP_DIR/$VALID_TAG ]] && [[ -d $TMP_DIR/dalvik-cache ]]; then
          mount -t ext4 -o $MOUNT_OPT $PARTITION2 /data
        else
          mount -t vfat $PARTITION1 $TMP_DIR
          if [[ "$?" = "0" ]]; then
            if [[ -f $TMP_DIR/$INIT_TAG ]]; then
              rm $TMP_DIR/$INIT_TAG
              umount $TMP_DIR
              rm -r $TMP_DIR/*
              rm -r $TMP_DIR/.*
              cp -a /data/. $TMP_DIR
              touch $TMP_DIR/$VALID_TAG
              mount -t ext4 -o $MOUNT_OPT $PARTITION2 /data
            else
              umount $TMP_DIR
            fi
          fi
        fi
        umount $TMP_DIR
      fi
      rmdir $TMP_DIR
    fi
To use:

  1. Create two partitions on SD card. Make the first fat32. It will be external_SD to Android. Some software can resize a partition so you can keep files on an existing fat32 partition. Make the second ext4. It will be Android's /data partition. The order matters. Make sure the ext4 partition is larger than the phone internal storage (duh). Make sure whatever software you use to make partitions is able to properly align them.
  2. In the first fat32 partition, make an empty file ".LGF6DataOnSD_INIT" in the partition's root directory. Normally the first fat32 partition is mounted as /storage/external_SD on the phone. In other words, if you do this step on the phone, create an empty "/storage/external_SD/.LGF6DataOnSD_INIT".
  3. Insert the SD card into the phone if it's not in there already. Then reboot the phone.
First time booting will take a while. The script will copy all files from internal /data storage to the SD card's ext4 partition. Afterwards, the SD's ext4 will become the /data partition. The phone's internal /data partition is hidden and unmodified.

To uninstall:

  1. Remove "/system/etc/init.d/zinit.sh".
  2. Remove "/system/etc/init.d" if the directory is empty.
  3. Remove "/system/bin/app_process" (size=9572) and rename the original file ("/system/bin/app_process-original" in the above example) back to "app_process".
Some notes:

  • Do not remove the SD while the phone is using it as the /data partition.
  • To boot the phone with its internal /data storage, simply remove the SD card (with phone powered off). If you need to access the SD's fat32 partition afterwards, insert the SD after the phone has booted (powered on) with its internal /data. Rebooting the phone with the SD inserted should mount the SD's ext4 as /data again.
  • Don't use CWM or similar to wipe data. I don't know what would happen. Since you can now take out the SD card (with phone powered off), you can wipe (or copy/backup/restore/resize) the SD's ext4 partition on a PC.
  • The script puts an empty file ".LGF6DataOnSD_DO_NOT_REMOVE" in the SD's ext4 partition's root directory. Don't remove it. The script checks it at boot. However, if you want to start over from the state of the phone's internal /data without reformatting, you can remove ".LGF6DataOnSD_DO_NOT_REMOVE" from the ext4 partition (under /data on the phone), create an empty ".LGF6DataOnSD_INIT" on the fat32 partition (under /storage/external_SD on the phone), and reboot. Doing this will erase all files on SD's ext4 partition and copy all files from the phone's internal /data partition to the SD's ext4 partition again.
  • The script has minimal error checking, so it might not mount the SD partition if something goes wrong. However, in that case, the phone should be able to boot up with its internal /data intact.
  • As JVene has said, this method is not compatible with Xposed. To get them to work together, The "app_process" of Xposed will need to be modified to run zinit.sh before Android itself is loaded. This requires editing its source and recompiling.
I hope everything is clear. Good luck.

Is this almost same as "F6Utilities2.3.1.apk" ?
so result should be same like install F6Utilities in a rooted stock rom ?
difference ?
 
I don't know much about XInternalSD. But I guess like Blackflag4 said, XInternalSD works on Android apps by changing the behavior of Android APIs which apps use. JVene's method works on Android itself. In other words, with XInternalSD, Android itself keeps /data (where pretty much all persistent user data are stored) on internal storage, but the apps get tricked into storing their data (ones meant for the "internal SD card") somewhere else , e.g. on the external SD. With JVene's method, all of /data is kept on the external SD.

A word about Android's "internal SD card" on the F6. The phone's "internal SD" is part of the internal storage. It's under /data/media and mounted at /storage/sdcard0. The "external SD" is the first fat32 partition on the physical microSD card and is mounted at /storage/external_SD. For example, in LG's camera and camcorder apps, there's a setting to change where the pictures or videos are stored. With JVene's method, like other methods that achieve that same goal, both internal SD and external SD will reside on the physical microSD card.

As for F6Utilities2, I guess from pressy4pie's discussions in this thread, it works similarly, but I can't say for sure since I have no experience with it. Based on pressy4pie's own SDcard hack thread, the hack requires custom boot and recovery images, so it's not compatible with any other kernel. pressy4pie also mentioned requiring a factory reset before installing. And since I've never installed it myself, I can't say what would happen if you boot the phone without the SD card. These are just some possible differences I can think of. On my phone, using JVene's method and my script, I haven't installed any third-party boot or recovery yet. Though I haven't tried, it should be possible to unroot. So far, I haven't done any factory reset since I got the phone even when I was installing and testing the script. And I know the phone works fine without the SD card in it. To me, JVene's method is simple and transparent, so I think it should be possible to make it work with most if not all other roms/mods/hacks/phones.
 
Is this almost same as "F6Utilities2.3.1.apk" ?
so result should be same like install F6Utilities in a rooted stock rom ?
difference ?

From what I can tell, you have to do a factory reset with the new F6Utilities and there is no way to to get your previous app data back. This new method copies your current /data so you still have any applications and their respective settings and such.
 
....so.....i tried my hand at this....and got a looping boot animation...i'm using the KK beta4 rom...so ...i dunno if that was the issue...

or i'm just too dumb to follow the instructions correctly...

it was kinda comical to watch the android wiz on the apple...but ,after the 10th time i was'nt sure if that was the way things were supposed to go...and reflashed KK...

things are normal as it gets.... i was hoping it would work...and followed the instructions ...but, i was'nt getting lucky ...

i had to go through this with my samsung admire (the tiny internal memory)...but, things were more compliant when i used app2sd .....

all these hacks ....i tried the flip flop init file and it did what it said what it would do...when it would'nt break itself...or make emulations and not just make things go on the sd card..

man...i wish i had known this phone had such a awful flaw and read more than the super cool features..what a downer :thumbdown:
 
....so.....i tried my hand at this....and got a looping boot animation...i'm using the KK beta4 rom...so ...i dunno if that was the issue...

or i'm just too dumb to follow the instructions correctly...

it was kinda comical to watch the android wiz on the apple...but ,after the 10th time i was'nt sure if that was the way things were supposed to go...and reflashed KK...

things are normal as it gets.... i was hoping it would work...and followed the instructions ...but, i was'nt getting lucky ...

i had to go through this with my samsung admire (the tiny internal memory)...but, things were more compliant when i used app2sd .....

all these hacks ....i tried the flip flop init file and it did what it said what it would do...when it would'nt break itself...or make emulations and not just make things go on the sd card..

man...i wish i had known this phone had such a awful flaw and read more than the super cool features..what a downer :thumbdown:

It sounds like your zinit never exited or your /data had problems. I had to go in ADB and copy my stuff manually because certain folders wouldn't work with cp. It's not that difficult if you have a little knowledge of bash, so you might want to try that.
 
Thanks to JVene for all the hard work and info. His posts provided enough details to get the solution working. Also thanks to likwid2 for confirming this method works.

Prerequisites:

  • rooted stock rom. Having stock may not be necessary, but the file JVene provided is built against Android 4.1.2.
  • microSD card with fast random read/write. Use Samsung or SanDisk.
  • some way to partition and format the microSD. Do it on a PC or use one of the available guides to do it on the phone.
  • some way to manage files. Use a file manager or a terminal emulator.
To install:

  1. Get the replacement "app_process".
    • Download JVene's "app_process_4_1_2_r1.gz" (post #16).
    • Uncompress to get "app_process_4_1_2_r1" (size=9572).
  2. Copy "app_process_4_1_2_r1" to the phone's /system/bin directory.
  3. Correct file owner and permissions of "app_process_4_1_2_r1": uid=0 (root), gid=2000 (shell), permissions=755 (-rwxr-xr-x).
  4. Rename the original "app_process" (size=9500) to something else like "app_process-original" and rename "app_process_4_1_2_r1" to "app_process".
  5. Under /system/etc, create subdirectory "init.d" (uid/gid=0, permissions=755, drwxr-xr-x).
  6. Under /system/etc/init.d, either create "zinit.sh" (uid/gid=0, permissions=750, -rwxr-x---) or copy the file there then modify owner/permissions:
    Code:
    #!/system/bin/sh
    
    # NO WARRANTY OF ANY KIND. USE AT YOUR OWN RISK!
    
    # tested on LG MS50012b
    
    PARTITION1="/dev/block/vold/179:33"
    PARTITION2="/dev/block/vold/179:34"
    TMP_DIR="/cache/data_tmp"
    MOUNT_OPT=nosuid,nodev,noauto_da_alloc,resuid=1000,errors=continue
    VALID_TAG=".LGF6DataOnSD_DO_NOT_REMOVE"
    INIT_TAG=".LGF6DataOnSD_INIT"
    
    if [[ -b $PARTITION2 ]] && [[ ! -d $TMP_DIR ]]; then
      mkdir $TMP_DIR
      mount -t ext4 -o $MOUNT_OPT $PARTITION2 $TMP_DIR
      if [[ "$?" = "0" ]]; then
        if [[ -f $TMP_DIR/$VALID_TAG ]] && [[ -d $TMP_DIR/dalvik-cache ]]; then
          mount -t ext4 -o $MOUNT_OPT $PARTITION2 /data
        else
          mount -t vfat $PARTITION1 $TMP_DIR
          if [[ "$?" = "0" ]]; then
            if [[ -f $TMP_DIR/$INIT_TAG ]]; then
              rm $TMP_DIR/$INIT_TAG
              umount $TMP_DIR
              rm -r $TMP_DIR/*
              rm -r $TMP_DIR/.*
              cp -a /data/. $TMP_DIR
              touch $TMP_DIR/$VALID_TAG
              mount -t ext4 -o $MOUNT_OPT $PARTITION2 /data
            else
              umount $TMP_DIR
            fi
          fi
        fi
        umount $TMP_DIR
      fi
      rmdir $TMP_DIR
    fi
To use:

  1. Create two partitions on SD card. Make the first fat32. It will be external_SD to Android. Some software can resize a partition so you can keep files on an existing fat32 partition. Make the second ext4. It will be Android's /data partition. The order matters. Make sure the ext4 partition is larger than the phone internal storage (duh). Make sure whatever software you use to make partitions is able to properly align them.
  2. In the first fat32 partition, make an empty file ".LGF6DataOnSD_INIT" in the partition's root directory. Normally the first fat32 partition is mounted as /storage/external_SD on the phone. In other words, if you do this step on the phone, create an empty "/storage/external_SD/.LGF6DataOnSD_INIT".
  3. Insert the SD card into the phone if it's not in there already. Then reboot the phone.
First time booting will take a while. The script will copy all files from internal /data storage to the SD card's ext4 partition. Afterwards, the SD's ext4 will become the /data partition. The phone's internal /data partition is hidden and unmodified.

To uninstall:

  1. Remove "/system/etc/init.d/zinit.sh".
  2. Remove "/system/etc/init.d" if the directory is empty.
  3. Remove "/system/bin/app_process" (size=9572) and rename the original file ("/system/bin/app_process-original" in the above example) back to "app_process".
Some notes:

  • Do not remove the SD while the phone is using it as the /data partition.
  • To boot the phone with its internal /data storage, simply remove the SD card (with phone powered off). If you need to access the SD's fat32 partition afterwards, insert the SD after the phone has booted (powered on) with its internal /data. Rebooting the phone with the SD inserted should mount the SD's ext4 as /data again.
  • Don't use CWM or similar to wipe data. I don't know what would happen. Since you can now take out the SD card (with phone powered off), you can wipe (or copy/backup/restore/resize) the SD's ext4 partition on a PC.
  • The script puts an empty file ".LGF6DataOnSD_DO_NOT_REMOVE" in the SD's ext4 partition's root directory. Don't remove it. The script checks it at boot. However, if you want to start over from the state of the phone's internal /data without reformatting, you can remove ".LGF6DataOnSD_DO_NOT_REMOVE" from the ext4 partition (under /data on the phone), create an empty ".LGF6DataOnSD_INIT" on the fat32 partition (under /storage/external_SD on the phone), and reboot. Doing this will erase all files on SD's ext4 partition and copy all files from the phone's internal /data partition to the SD's ext4 partition again.
  • The script has minimal error checking, so it might not mount the SD partition if something goes wrong. However, in that case, the phone should be able to boot up with its internal /data intact.
  • As JVene has said, this method is not compatible with Xposed. To get them to work together, The "app_process" of Xposed will need to be modified to run zinit.sh before Android itself is loaded. This requires editing its source and recompiling.
I hope everything is clear. Good luck.

Confirmed that this works perfect on Xperion !!!
- I was on metropcs 10i stock rom, rooted & with TWRP recovery.
- Flashed latest Xperion.
- Uninstalled all xposed.
- installed this
- restored all my apps with Titanium Backup Pro.

Everything works perfect, 100% issue free.

Thanks a lot.
 
....so.....i tried my hand at this....and got a looping boot animation...i'm using the KK beta4 rom...so ...i dunno if that was the issue...

JVene said his modified app_process might work up to 4.4.2 but for KK compatibility a new one should probably be built. The source for the KK's app_process does show minor differences from JB's version, and that could be the cause of the problem. In addition, custom roms could have their own modified versions, and in those cases they would need to be patched at the source level. That's why I mentioned rooted stock, because that's what JVene provided and in my instructions I provided file sizes for quickly checking the files match.

There are two places things can go wrong in this method: app_process or zinit.sh. If the app_process part doesn't work, the phone won't boot. Technically, zinit.sh could loop or stall and the phone will be stuck also, but I don't think I put anything in my script to cause that condition. And if the script fails, in most (if not all) cases I can think of, the script should do nothing to the system itself to prevent it from booting, except perhaps making a mess on the external SD card but that shouldn't cause boot problems.

I had to go in ADB and copy my stuff manually because certain folders wouldn't work with cp.
That's interesting. Do you know what type(s) of folders failed with cp? I also thought about using tar in the script, but I couldn't be sure the temporary file would always fit on the phone so I just used cp.

Everything works perfect, 100% issue free.
You're welcome and thanks for the confirmation.
 
That's interesting. Do you know what type(s) of folders failed with cp? I also thought about using tar in the script, but I couldn't be sure the temporary file would always fit on the phone so I just used cp.
For some reason, it was skipping over folders that were full of cached images, namely chrome and my home screen app. This wasn't really a problem with the chrome cache, but the images for my home screen app are only downloaded once, so I would've had to reinstall to redownload them. No matter what options I put, cp would always say it doesn't support that type of file when I cp'd everything, but would work just fine when I only did those folders separately.
 
If "cp -a" can't copy everything as is, then we might have to go with "tar -cp" and pipe the result directly to "tar -xp". If someone else sees this problem also, I can try to see if that way works better.

Another issue I just thought of. Xperion and many custom roms support init.d. It's possible init.d support could load the zinit.sh script directly without needing the app_process modification. If someone using a rom with init.d support is willing to test this (no app_process change, just zinit.sh in /system/etc/init.d, possibly renamed to enable its execution), this method might be a simple fix for users of those roms. Note that if other init.d scripts running before zinit.sh need to access /data, they would be accessing the internal storage. (Edit: JVene has mentioned init.d loads too late, after zygote, I guess because that way init.d scripts can affect Android processes as well, not sure. I don't know whether different roms would implement init.d support differently. If init.d can't be used, then app_process modification would still be necessary.)

I should also change my script to avoid possibly double mounting the partition if the script is executed more than once, with an extra check of ".LGF6DataOnSD_DO_NOT_REMOVE" in the beginning. Functionally it wouldn't matter, but it's the right thing to do.
Code:
#!/system/bin/sh

# NO WARRANTY OF ANY KIND. USE AT YOUR OWN RISK!

# tested on LG MS50012b

PARTITION1="/dev/block/vold/179:33"
PARTITION2="/dev/block/vold/179:34"
TMP_DIR="/cache/data_tmp"
MOUNT_OPT=nosuid,nodev,noauto_da_alloc,resuid=1000,errors=continue
VALID_TAG=".LGF6DataOnSD_DO_NOT_REMOVE"
INIT_TAG=".LGF6DataOnSD_INIT"

if [[ -f /data/$VALID_TAG ]]; then
  exit 0
fi
if [[ -b $PARTITION2 ]] && [[ ! -d $TMP_DIR ]]; then
  mkdir $TMP_DIR
  mount -t ext4 -o $MOUNT_OPT $PARTITION2 $TMP_DIR
  if [[ "$?" = "0" ]]; then
    if [[ -f $TMP_DIR/$VALID_TAG ]] && [[ -d $TMP_DIR/dalvik-cache ]]; then
      mount -t ext4 -o $MOUNT_OPT $PARTITION2 /data
    else
      mount -t vfat $PARTITION1 $TMP_DIR
      if [[ "$?" = "0" ]]; then
        if [[ -f $TMP_DIR/$INIT_TAG ]]; then
          rm $TMP_DIR/$INIT_TAG
          umount $TMP_DIR
          rm -r $TMP_DIR/*
          rm -r $TMP_DIR/.*
          cp -a /data/. $TMP_DIR
          touch $TMP_DIR/$VALID_TAG
          mount -t ext4 -o $MOUNT_OPT $PARTITION2 /data
        else
          umount $TMP_DIR
        fi
      fi
    fi
    umount $TMP_DIR
  fi
  rmdir $TMP_DIR
fi
 
I just received the F6 and was searching for an alternative to solve the storage problem. When I found Jvene's info I figured that would be the ideal solution, and a transparent way to increase storage size. Never having finished completing his solution and making it available in a setup for end-users or even testing I got frustrated waiting and resumed looking for available methods. I came across mounts2sd, and after reading what it does and how it works I realized that it accomplished what Jvene outlined, albeit in a sightly different fashion. Instead of using app_process it used an init.d script, with a workaround that pauses Android while the script does the "magic" and swaps everything. I've been using it for about 4 days, so far seems fully functional, I tested Google Play by downloading Walking Dead seasons 1 and 2, nearly a gig apiece. Downloaded, installed and ran without a hitch.

Interestingly it also can be used after init.d injector, which replaces whatever init.d you have with its version, and has a method that holds android from loading until after the whole mounts2sd script has executed.In essence it does what Jvene was outlining and what your script does, with the added bonus of having a variety of options one could chose from.

I believe mounts2sd would work on the kitkat rom that is floating around, I have been using Xposed with Gravity Box, so it has that as an added bonus. Which leads me to say to you ABsolutely awesome that you got this method to work! When I first read Jvene's posts, I was excited to read about his theory, eager to try and use it like the others on here, and disappointed when it seemed to fall through. I even tried to make it work but I lacked the skills. I haven't tried your implementation, I might give it a spin later on for comparison. but it looks like you delivered on what Jvene had offered! I just wanted to mention m2sd in case anybody was looking for a solution that works with xposed and maybe KK. I know I didn't see much about it, until AFTER I had found it.

Currently using Xperion rom, 16g SD card
 
Thanks for the info on mounts2sd! If there's already a method that works well with other roms/Xposed, then I will stop messing with my script, at least for the time being. I will look into mounts2sd later to understand it better.

The reason I want to use JVene's method is because I'm supporting another user and I'd like to keep that user's phone as close to LG's stock rom as possible. I don't even want root on that phone in case that user messes up. I believe JVene's method allows me to unroot afterwards, so I want to have an implementation that's as simple and transparent as possible. This way I can possibly revert all changes before doing the eventual upgrade to the official KK. Though I don't know how LG does their OTA, so maybe my concern is irrelevant. With a rooted phone I can do backup/restore as usual, but if an OTA update can take, then I don't need to have physical access to that user's phone to upgrade. Anyway, just thought I'd share my script for those who might find it useful.
 
Ok....it was me...I should've read it more carefully...

..well...maybe I'll try it with XPERION or DANA later....maybe I need to learn some patience with my phone...

I've actually gotten to like Google launcher more than Go launcher....a little...

Thank you for all your efforts.
 
I understand where you are coming from about keeping your user's phone stock as possible for the OTA's. I don't know if it would work on his phone, but that init.d injector adds init.d support and also a boot.d, which from what I read basically stops android from booting while it finishes the script (s). Like the modified app-process calls zinit before the zygote starts booting. If that works, then it would basically be doing the same thing through different methods. I don't think root is required.

Also, just to be clear I was in no way trying to diminish or take anything away from what you accomplished! From the little bit I've picked up trying to figure out the best solution for the mem problem of the F6, you did a fantastic job of taking Jvene's concept and making it happen. You could possibly automate things even more, make a Xposed version, a version for different Android builds, even package it as an app for the Markets!

Check mnts2sd (maybe init.d injector) out, might find something useful to help with your user's phone or something useful for your project, you can build the ultimate memory swapper! Anyway. I am going to try out your set up, curious now what kind of differences I might find.
 
For the most part, this has been great. Many thanks to JVene for the method and WarrantyVoider for the script because I couldn't write one that worked. The only problem I've had is, since actually getting it to mount to the SD card, my phone has been randomly freezing and rebooting a few times a day. I'm not sure what is causing this problem and it's baffling me. I have a Sandisk Pixtor UHS-class 1 card in it, so I doubt it's transfer rate and being as JVene's only change to app_process was to include zinit before zygote, I don't think it's that. I'm just so lost. :/
 
I installed it on Xperion and (xposed uninstalled first) and must say that 0 issue found, tested everything: calls, texting, chatting, even banking apps (Wells Fargo).
 
Also, just to be clear I was in no way trying to diminish or take anything away from what you accomplished! From the little bit I've picked up trying to figure out the best solution for the mem problem of the F6, you did a fantastic job of taking Jvene's concept and making it happen. You could possibly automate things even more, make a Xposed version, a version for different Android builds, even package it as an app for the Markets!
Don't worry. I didn't take whatever you've said negatively. Besides, I like constructive criticism and information regarding other methods, so feedback and comments of that nature are helpful. JVene's posts are like an engineering journal, and I've learned a lot from them. I'm not sure if I want to or am able to take his concept further. He had a lot of great ideas in his posts, but to make anything else work will probably require a lot of learning first.

As for mounts2sd, I don't think it works quite like JVene's method. From "What is SD-EXT, https://github.com/SpazeDog/mounts2sd#what-is-sd-ext : "the sd-ext script moves one or more sub-folders from /data to sd-ext" and "the script will then mount (link) each sub-folder from sd-ext and back to /data where Android can find it." I think that implies internal storage is still being used by Android and that the external SD card and internal storage are not independent. So if I understand correctly, this is still in essence an Android hack like link2sd, whereas JVene's method is really a Linux hack except the need to modify app_process, which, in addition to being used as an entry point to load zinit (the Linux part), is normally used by Android to load java classes (the Android part). The Android part is the reason app_process needs to be modified to match the right Android version, but that's a straightforward compile job.

Still, mounts2sd looks like an impressive project. Thanks for letting me know about it and I'll keep it in mind in case I have a need for it in the future.
 
For the most part, this has been great. Many thanks to JVene for the method and WarrantyVoider for the script because I couldn't write one that worked. The only problem I've had is, since actually getting it to mount to the SD card, my phone has been randomly freezing and rebooting a few times a day. I'm not sure what is causing this problem and it's baffling me. I have a Sandisk Pixtor UHS-class 1 card in it, so I doubt it's transfer rate and being as JVene's only change to app_process was to include zinit before zygote, I don't think it's that. I'm just so lost. :/
My guess is that not all files were copied successfully, since you've had problems with that part the first time. So like I said before, if
Code:
cp -a /data/. $TMP_DIR
misses some things, maybe try
Code:
tar -cp -C /data ./ | tar -xp -C $TMP_DIR
instead.

Another possibility is some cached files became corrupt when you went from booting with internal storage to booting with external SD. If so, cache and dalvik cache may need to be wiped so they could be rebuilt.

Last one I can think of right now is the file system may have an error. If that error is on the ext4 partition of the external SD, you can put the SD card in a Linux PC and run fsck to fix it. Or you can reformat that partition and start over from the state of your internal /data if you don't care about the data already on the SD.

Good luck.
 
imma try it again...this time i hope i dont brick my phone...i tried the xposed modules ans STILL get the out of room message....DANG!!
 
Back
Top Bottom