[Galaxy Tab 7.7 Android Development] darz:
[MOD] Swap Internal & External SD [CM9, CM10, rooted stock XXLQ1 and probably more]

Hi folks!

Like many of you I'm sure, I had the problem of running out of space on the internal SD and all the existing tricks seemed to be too much work. So I took mattiadj's script and just made a few changes for the 7.7 on CM9, then CM10, then rooted stock XXLQ1. Thanks mattiadj for this one!

I've tested this on the 7.7 but I suspect it will work on all other devices and other ROMs too.

WARNING: I'm just tinkering, I don't have any solid experience with ROMs, and I certainly take no responsibility for any damage or injuries caused by the following instructions! I'm just passing on helpful hints ;)

What does it do?

From what I understand the script remaps the SD directories, swapping the internal with the external.

init.d approach

Androguide.fr has been kind enough to convert the scripts into init.d scripts, check out the scripts here to test them out and let us know how you go!

What do you need?

- The script, either use one that is attached (extsd2internalsd_7.7cm9.txt or extsd2internalsd_7.7cm10.txt or extsd2internalsd_7.7RootedStockXXLQ1_v2.txt), or create your own.

- SManager to run the script.

- A file manager with root access to check the vold folder, the mounting points for the SD cards and to copy the script over.

Any Issues?

Only issue I have seen is sometimes the script is run (via SManager) after apps like swiftkey and so I temporarily get an error notification (language pack not found), but if you wait just a little while, SManager eventually runs the script and everything is back to normal.

[size=+2]What you need to do:[/size]

1) Confirm that the storage locations are:

/mnt/sdcard (internel) & /mnt/emmc (external) for CM9,

/storage/sdcard0 (internal) & /storage/sdcard1 (external) for CM10/JB,

/mnt/sdcard/ (internal) & /mnt/sdcard/extStorages/SdCard (external) for XXLQ1.

2) Confirm that the two files in /dev/block/vold are:

179:24 & 179:25 in CM9,

179:8 & 179:9 in in CM10,

179:8 & 179:9 in XXLQ1.

NOTE: If steps 1 or 2 show a different setup, follow the steps described in What I did listed below

3) Download or create appropriate script and copy to /data

4) Open the script using SManager, ENABLE Su, click save then run the script.

NOTE: if there is no output when you run the script then it probably means it was successful.

4b) ADDITIONAL STEP FOR ROOTED STOCK XXLQ1

After running the script once, you would have received one error message, the external SD is unlinked from /mnt/sdcard/extStorages/SdCard, and so the SdCard directory no longer exists.

Create a directory titled SdCard in /mnt/sdcard/extStorages and run the script again.

5) Check in Settings>Storage to see if the internal and external SDs have been swapped

NOTE: If the result is different for you, follow the steps described in What I did listed below

6) Go back to SManager and enable Su & Boot, then click Save

7) Reboot and check Settings>Storage again!

8) Feel smug about the fact you can install as many games as you want!!! :D

[size=+2]How it all works:[/size]

I picked up mattiadj's script for the S3 from his discussion thread [MOD] ExtSd2InternalSd v3|Increase your data storage|CMW zip|CM10|100% Working| and logically deduced the following format for the script:

mount -t vfat -o umask=0000 [EXTERNAL SD SOURCE LOCATION] [INTERNAL SD DESTINATION LOCATION]

mount -o bind [INTERNAL SD SOURCE LOCATION] [EXTERNAL SD DESTINATION LOCATION]

where:

[EXTERNAL SD SOURCE LOCATION] is the location where external sd can be referenced from. There are typically two files in /dev/block/vold/, one of those files is the external sd source location. For CM9 I set this to /dev/block/vold/179:25. For CM10 I set this to /dev/block/vold/179:9

[INTERNAL SD SOURCE LOCATION] is the location where internal sd can be referenced from. From what I understand, it is always /data/media.

[INTERNAL SD DESTINATION LOCATION] is the location where android will look for the internal sd. In CM9 I set this to /mnt/sdcard. In CM10 I set this to /storage/sdcard0.

[EXTERNAL SD DESTINATION LOCATION] is the location where android will look for the external sd. In CM9 I set this to /mnt/emmc. In CM10 I set this to /storage/sdcard1.

What I did:

1) I checked the storage locations to find that CM9 uses /mnt/sdcard (internel) & /mnt/emmc (external) for sd storage, and CM10/JB uses /storage/sdcard0 (internal) & /storage/sdcard1 (external).

2) Secondly I checked the /dev/block/vold to find two files, in CM9: 179:24 and 179:25, in CM10: 179:8 and 179:9.

3) To work out which vold file is correct I:

a) created a script using the information I found above

b) installed SManager

c) rebooted to ensure previous attempts didn't muck up the results

d) ran the script using SManager

e) checked Settings>Storage to confirm that script did in fact swap internal and external SDs.

After getting the correct vold file I:

4) Copied the script to /data/

5) Open the script in SManager and enabled Su and Boot (execute script on boot with SU permissions)

6) Rebooted and checked Settings>Storage once again.

Final scripts

FYI: The scripts attached contain the following:

===== 7.7 ExtSd2InternalSd for CM9 =======

mount -t vfat -o umask=0000 /dev/block/vold/179:25 /mnt/sdcard

mount -o bind /data/media /mnt/emmc

===== 7.7 ExtSd2InternalSd for CM10 =======

mount -t vfat -o umask=0000 /dev/block/vold/179:9 /storage/sdcard0

mount -o bind /data/media /storage/sdcard1

===== 7.7 ExtSd2InternalSd for rooted stock XXLQ1 version 2 =======

mount -t vfat -o umask=0000 /dev/block/vold/179:9 /mnt/sdcard

mount -o bind /data/media /mnt/sdcard/extStorages/SdCard

Like I said, I'm just a tinkerer, I'll be happy to help but keep in mind my expertise is limited. Let me know how you go!

Enjoy! And don't forget to swap the contents of the internal and external SD directories ;)

Again all credits go to mattiadj and his thread [MOD] ExtSd2InternalSd v3|Increase your data storage|CMW zip|CM10|100% Working|

POST HISTORY

[UPDATE: I've made some changes to this post to make it a bit easier to read]

[UPDATE 2: I've added some instructions on how to make this work for rooted stock XXLQ1, an additional step has been added in What you need to do section]

[UPDATE 3: I missed an important step before running the script. You MUST enable Su (and save) in SManager before you run the script!]

[UPDATE 4: Moved instructions to top for better readability]

[UPDATE 5: Testing out init.d method]