Post Reply

[MOD] Swap Internal & External SD [CM9, CM10, rooted stock XXLQ1 and probably more]

7th September 2012, 09:34 AM   |  #1  
OP Member
Thanks Meter: 23
 
30 posts
Join Date:Joined: Jan 2005
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.

What you need to do:
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!!!


How it all works:
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]
Last edited by darz; 13th September 2012 at 03:40 AM. Reason: Added another rom
The Following 13 Users Say Thank You to darz For This Useful Post: [ View ]
7th September 2012, 10:41 AM   |  #2  
Axelman8's Avatar
Senior Member
Flag Rotterdam
Thanks Meter: 131
 
446 posts
Join Date:Joined: Aug 2009
This is awesome.. Thnx for sharing dude
This might be usefull for a dev. to enable in a Rom installer.

Regards

Axelman

Sent from my GT-P6800 using xda app-developers app
7th September 2012, 12:01 PM   |  #3  
Account currently disabled
Thanks Meter: 269
 
1,586 posts
Join Date:Joined: Oct 2011
Gonna try this for sure....thank you!
11th September 2012, 02:45 PM   |  #4  
aletheus's Avatar
Senior Member
Thanks Meter: 268
 
586 posts
Join Date:Joined: Oct 2011
this would be the PERFECT thing to fix superbricked tabs... is there any way to run a script like this from adb? surely you've read about the superbrick hardware bug. well, from what i can tell, my internal memory is FRIED.... so being able to swap out the memory would be AWESOME, but i need it to be a switch on a much deeper level than whether or not swiftkey will start before or after this script. like is there a way to change this thing permanently?
11th September 2012, 04:13 PM   |  #5  
Senior Member
Thanks Meter: 7
 
214 posts
Join Date:Joined: Oct 2008
Quote:
Originally Posted by aletheus

this would be the PERFECT thing to fix superbricked tabs... is there any way to run a script like this from adb? surely you've read about the superbrick hardware bug. well, from what i can tell, my internal memory is FRIED.... so being able to swap out the memory would be AWESOME, but i need it to be a switch on a much deeper level than whether or not swiftkey will start before or after this script. like is there a way to change this thing permanently?

dunno how to write the script correctly but would love to have one made for stock ics, non cm9/10 users
11th September 2012, 07:36 PM   |  #6  
OP Member
Thanks Meter: 23
 
30 posts
Join Date:Joined: Jan 2005
Quote:
Originally Posted by aletheus

this would be the PERFECT thing to fix superbricked tabs... is there any way to run a script like this from adb? surely you've read about the superbrick hardware bug. well, from what i can tell, my internal memory is FRIED.... so being able to swap out the memory would be AWESOME, but i need it to be a switch on a much deeper level than whether or not swiftkey will start before or after this script. like is there a way to change this thing permanently?

I wouldn't know where to start, but mattiadjn has created a kernel mod for the s3 which works great, but doesn't work for cm10 (hence the script). http://forum.xda-developers.com/show....php?t=1772234
11th September 2012, 09:09 PM   |  #7  
Senior Member
Thanks Meter: 7
 
214 posts
Join Date:Joined: Oct 2008
well it says my internal and external storage are swapped but not sure apps are being copied to the microsd actually, my external storage space is shrinking with all my installs (actually internal storage)... nice effort though.
12th September 2012, 12:28 AM   |  #8  
Senior Member
Thanks Meter: 7
 
214 posts
Join Date:Joined: Oct 2008
Quote:
Originally Posted by johnnobts

well it says my internal and external storage are swapped but not sure apps are being copied to the microsd actually, my external storage space is shrinking with all my installs (actually internal storage)... nice effort though.

Never mind, I think it is working running CM10. Would still love to get this working using stock ROM.
12th September 2012, 05:28 AM   |  #9  
OP Member
Thanks Meter: 23
 
30 posts
Join Date:Joined: Jan 2005
Quote:
Originally Posted by johnnobts

Never mind, I think it is working running CM10. Would still love to get this working using stock ROM.

Which ROM? give me an example and I'll give it a go.
12th September 2012, 06:31 AM   |  #10  
Senior Member
Thanks Meter: 7
 
214 posts
Join Date:Joined: Oct 2008
Quote:
Originally Posted by darz

Which ROM? give me an example and I'll give it a go.

the quicksilver pre 1.0 is one of my favorite custom ics roms. but also the P6800XXLQ2_P6800OXALQ2_ATO stock rom maybe?

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes