yashsingh1/xdaforums huggingface dataset:
[Galaxy Tab 2 7" Android Development] DivinityCycle:
UPDATES!

I presently testing out my "new" method for accomplishing this.

I learned how to modify the boot.img portion of the OS, which contains the init scripts that run during device startup.

Specifically, I modified init.espresso.rc, which sets up the symlinks that make the two sdcard spaces accessible to "legacy" apps (which is almost all of them for now).

Here's the top of the original file:

import init.espresso.usb.rc

on early-init
export EXTERNAL_STORAGE /storage/sdcard0
export SECONDARY_STORAGE /storage/sdcard1
mkdir /storage 0050 system sdcard_r
mkdir /storage/sdcard0 0000 system system
mkdir /storage/sdcard1 0775 system system
mkdir /storage/usbdisk0 0775 system system

# for backwards compatibility
symlink /storage/sdcard0 /sdcard
symlink /storage/sdcard0 /mnt/sdcard
symlink /storage/sdcard1 /extSdCard
symlink /storage/sdcard1 /mnt/extSdCard
symlink /storage/usbdisk0 /usbdisk0
symlink /storage/usbdisk0 /mnt/usbdisk0

And here's my modified version:

import init.espresso.usb.rc

on early-init
export EXTERNAL_STORAGE /storage/sdcard1
export SECONDARY_STORAGE /storage/sdcard1
mkdir /storage 0050 system sdcard_r
mkdir /storage/sdcard0 0000 system system
mkdir /storage/sdcard1 0775 system system
mkdir /storage/usbdisk0 0775 system system

# for backwards compatibility
symlink /storage/sdcard1 /sdcard
symlink /storage/sdcard1 /mnt/sdcard
symlink /storage/sdcard1 /extSdCard
symlink /storage/sdcard1 /mnt/extSdCard
symlink /storage/usbdisk0 /usbdisk0
symlink /storage/usbdisk0 /mnt/usbdisk0

In case you're wondering what's different, basically all the references for /sdcard and /mnt/sdcard are mapped to /storage/sdcard1 (the real micro SD card). This means that the "fake" sdcard space is still there, mounted to /storage/sdcard0.

Also, the export lines set both of the "Storage" system variables to again point at /storage/sdcard1, the "real" SD card.

This sets things up so, for all meaningful ways, the external SD card is the spot apps will use by default when writing data.

I am still downloading & testing more apps, but so far everything has worked as expected.

The only drawback to this method is that it involves a boot.img being flashed to your tab.

The boot.img files contain the system kernel, and so they're NOT generic.

I'm gonna make flashable packages for various ROMs, as well as "undo" packages.

This method ONLY modifies init.espresso.rc, vold.fstab and other stuff is left untouched.

So far everything I have tested works fine.

Anyone want to beta test this method?

-EDIT-

Forgot to mention, if you wanna test it out, I'll need to know what exact ROM you're using, or you could post your boot.img file. Should be found in the "root" of your ROM's flashable ZIP file.
[Galaxy Tab 2 7" Android Development] fsubartender:
I will test. I am using RomsWell V 1.0 on a 3113

If that helps get the info you need. My 8 GB internal is filling up rather quickly
[Galaxy Tab 2 7" Android Development] DivinityCycle:
The one from here: http://xdaforums.com/showthread.php?t=1835160 ?

for the 3113 right? Downloading it now, it's huge for a ROM! (700 MB??)
[Galaxy Tab 2 7" Android Development] RomsWell:
Only huge compaired to cm :p
[Galaxy Tab 2 7" Android Development] fsubartender:
Thats what she said..

Sorry couldnt resist..I watch too much The Office.

But yes that is it. I like using the Docking Keyboard that came in the Student Edition and Peel Remote, which dont work with some other roms I have test drove.

---------- Post added at 08:02 PM ---------- Previous post was at 08:00 PM ----------

Now you incorporate ths working script into the V2 of the ROM..you are :good:THEMAN:good:
[Galaxy Tab 2 7" Android Development] DivinityCycle:
Yeah you must use the "stock" kernel to use that hardware, since the drivers are proprietary and not present in the open source kernels used on things like AOKP and CM. Seeing about getting at least the IR module sorted out has been on my "To Do" list for a while now, but getting a flashable SSH/SFTP server is my current top priority, since that will make all other projects easier for me...

I got the boot.img extracted, but its an ICS ROM so the mount points are slightly different than they are on JB.

Looks like /mnt/sdcard is the "real" mount point for the fake SD, and /mnt/extSdCard is the "real" mount point for the microSD card.

What I did was remap the /sdcard symlink to point at /mnt/extSdCard, and also changed the "EXTERNAL_STORAGE" variable to that too, but the path /mnt/sdcard is hardcoded in the Samsung sdcard service, so that path is pretty much stuck on the internal storage space.

I created two ZIP packages for you.

The SDcardswap-RomsWell-V1.0.zip file is a flashable package you can flash using ClockWorkMod, it'll install the modified boot.img.

The "Undo" package is to flash the original boot.img back onto your tablet in case mine somehow screws things up.

I recommend downloading both onto your tablet before flashing, so you can easily fix things if something goes wrong.

I also recommend doing a backup of your critical data first, so you can then freely delete and/or move stuff around.

I primarily used games and apps that download stuff to the "sdcard" space as my test, things like GTA3 and Dead Space.

Either post on here or throw me a PM with any issues or questions.
[Galaxy Tab 2 7" Android Development] rsage:
First, great work on this! My GTab2 will be arriving in a couple days, and I want to implement this fix as soon as possible. I'll have to run a modified stock ROM like one of RomsWell's (I need to be able to use the keyboard provided in the bundle). Until testing the boot.img solution on rooted stock ROM's is verified/completed, is this the current working solution for ICS ROMs:

http://xdaforums.com/showpost.php?p=29901478&postcount=70

I've read through the entire thread but am a little lost as to what is currently working for ICS. I'm very familiar with SManager, so I have no problem with that solution, just want to make sure that's the way to go for now...
[Galaxy Tab 2 7" Android Development] DivinityCycle:
Right, until someone actually tests out the switch in ICS, we won't know how well it works. I am personally running CM10, and I really don't feel like going back to ICS to test things out again (already did that once). I may do that if I do a complete backup first, but I wasn't planning on it.

fsubartender hasn't sent me anything so we'll need someone to test it out.

It should be really easy to test out if you're running ROMswell.
[Galaxy Tab 2 7" Android Development] rsage:
If no one tests, I'll give it a shot when my tab arrives
[Galaxy Tab 2 7" Android Development] highandmighty00:
I am running the latest aokp nightly now back between this and cm10.I will definitely test this out if you want to post zips for either of those roms.I will post boot.img from my current rom if you would like I'm just not at my pc at the moment.I appreciate your work on this though as this matter alone almost made me regret buying this tab in the first place.
[Galaxy Tab 2 7" Android Development] ketut.kumajaya:
A sneak peak for extSdCard as sdcard solution

UPDATE:

[BOOT][GT-P3100][STOCK 4.0.4] KK-Boot - CF-Root-S5830 adaptation for Galaxy Tab 2 7.0

Still working on my own custom boot image, a sneak peak for extSdCard as sdcard solution:

init.post_boot.sh link /mnt/sdcard to /mnt/extSdCard and mount /data/media to /mnt/media:

#!/system/bin/sh

# Ketut P. Kumajaya, Aug 2012

if [ $(/sbin/propget customboot.sdcard) = "external" ]; then
if [ "$(busybox mount | grep -c sdcard)" = "0" ]; then
busybox mount -o remount,rw /
busybox rm /mnt/sdcard
busybox ln -s /mnt/extSdCard /mnt/sdcard
busybox mount -o remount,ro /
fi;
fi;

init.espresso.rc:

# blackhawk - for external sdcard as internal sdcard
#mkdir /mnt/sdcard 0000 system system
mkdir /mnt/media 0000 system system
symlink /mnt/media /mnt/sdcard

# blackhawk - for external sdcard as internal sdcard, create virtual SD card at /mnt/media
#service sdcard /system/bin/sdcard /data/media 1023 1023
service sdcard /sbin/sdcard /data/media 1023 1023
class late_start

post-boot service in init.rc:

# blackhawk - post boot service
service post-boot /system/bin/sh /system/etc/init.post_boot.sh
class main
user root
disabled
oneshot

# blackhawk - start post-boot service
on property:sys.boot_completed=1
start post-boot

Note:

- /sbin/propset and /sbin/propget scripts are my own scripts act like /system/bin/setprop and /system/bin/getprop.

- /sbin/sdcard is a modified /system/bin/sdcard to mount fuse dev to /mnt/media

I want to create an elegant solution (user still can eject the external sdcard anytime for an example), freedback are welcome!
[Galaxy Tab 2 7" Android Development] CXENTE:
Im on ics 4.0.4,, flashed romswell zip ..and nothing....still low storage
[Galaxy Tab 2 7" Android Development] DivinityCycle:
I was wondering if it were possible to modify the stupid /sdbin/sdcard service. All I have to work with are binaries, and I don't (currently) have any way to compile my own builds.

That's HUGE because once you can mount the fake sdcard to a different location, you're free to mount whatever you want wherever you want, like you're doing with the external SD card.

Does the blackhawk service do anything with permissions? I've been testing out using my Micro SD card formatted with ext4, and it works great except for the occasional permission error. I was looking for a good way to make mounted ext4 behavior similarly to FAT32 with regard to user permissions, but hadn't had time to look into it yet.

I have been busy lately at work with doing actual work (imagine that!), and at home I've been setting up a Linux environment. One of the things I want to do is begin setting up an Android development environment.

I also ordered a T-Mobile Galaxy Tab 2 Plus, which is basically the P3113 I have with 4G. Once I get that, I will be more free to do things like go back to ICS on my P3113 for testing.
[Galaxy Tab 2 7" Android Development] fsubartender:
I installed the fix and played with it for a bit..still doesnt seem to work.
[Galaxy Tab 2 7" Android Development] fsubartender:
Reading thru some of the other device threads i ran across this one

http://xdaforums.com/showthread.php?t=1831195

"Features:

-

-

- App2SD support (When you have a microSD inserted, it will swap your microSD and internal storage on boot. To disable, simply take out microSD card during boot and insert after booting.) If you are doing this the first time, you might want to contents of your internal storage to microSD card to keep app data. This allows you to use up to 64GB for app storage instead of 16/32GB it comes with."

I bet this dev can help with our lil tabs.
[Galaxy Tab 2 7" Android Development] DivinityCycle:
I am still keeping my 3113 on CM10 until I get my new 4G tab. However, I had to RMA mine, so I won't have a new one until Tuesday.
[Galaxy Tab 2 7" Android Development] wowmail:
Only Gameloft games chew up my space, the rest is media that's on SD anyway.

At the Moment I'm on CM10 with Directory Bind.

http://xdaforums.com/showthread.php?t=1410262&page=62

I did try the script, it worked, but I could not access internal storage at all.

Keep up the excellent work, I know this will be an elegant solution.

Thank You
[Galaxy Tab 2 7" Android Development] ketut.kumajaya:
How about this:

/system/etc/init.d/00sdcard:

#!/system/bin/sh

# Ketut P. Kumajaya, Aug 2012

if [ $(/sbin/propget customboot.sdcard) = "external" ]; then
busybox mount -t auto -o uid=1000,gid=1023,noatime,nodiratime /dev/block/mmcblk1p1 /mnt/extSdCard
busybox mount -o bind /mnt/extSdCard /mnt/sdcard
else
busybox mount -o bind /mnt/media /mnt/sdcard
fi;

init.espresso.rc:

# blackhawk - for external sdcard as internal sdcard
mkdir /mnt/sdcard 0000 system system
mkdir /mnt/media 0000 system system

# blackhawk - for external sdcard as internal sdcard, create virtual SD card at /mnt/media
#service sdcard /system/bin/sdcard /data/media 1023 1023
service sdcard /sbin/sdcard /data/media 1023 1023
class late_start
[Galaxy Tab 2 7" Android Development] ketut.kumajaya:
Not work! My symlink metode still the best solution for now.
[Galaxy Tab 2 7" Android Development] DivinityCycle:
Hey guys, just wanted to give a quick status up, I have successfully received and setup my new 4G tablet, which is awesome.

This will free my WiFi-only tab for development :)
[Galaxy Tab 2 7" Android Development] rickwyatt:
iv think i got this to work on stock 4.0.4

data/media is now part of data so hole of internal for applications

sdcard in linked to extranal sdcard

going to test some more and ill let you no how i get on
[Galaxy Tab 2 7" Android Development] DivinityCycle:
I have downloaded stock, CM9, and CM10 ROMs for the P3113, just haven't had time to do anything with them yet. We have like 3 people either out sick or on vacation so work has been kinda busy today. My plan was to do a CM9 boot.img first, then go to stock. I want to put the stock ROM on there next to begin investigating the IR blaster's kernel module(s), to see about possibly making it work under CM10. Its the ONLY thing that doesn't work on this device that I "need".
[Galaxy Tab 2 7" Android Development] rickwyatt:
i did it by editing the boot.img and removing some stuff so data/media aint mounted then i adding init.d in install-recovery.sh

then added the script to it

#!/system/bin/sh

sleep 2
mount -o rw,remount -t rootfs rootfs /
mount -o umask=0000 -t vfat /dev/block/vold/179:25 /mnt/sdcard
# umount /mnt/sdcard

shell@android:/ # mount
mount
rootfs / rootfs rw,relatime 0 0
tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/platform/omap/omap_hsmmc.1/by-name/FACTORYFS /system ext4 ro,relatime
,barrier=1,data=ordered 0 0
/dev/block/platform/omap/omap_hsmmc.1/by-name/DATAFS /data ext4 rw,nosuid,nodev,
noatime,barrier=1,data=ordered,noauto_da_alloc,discard 0 0
/dev/block/platform/omap/omap_hsmmc.1/by-name/CACHE /cache ext4 rw,nosuid,nodev,
noatime,barrier=1,nomblk_io_submit,data=ordered 0 0
/dev/block/platform/omap/omap_hsmmc.1/by-name/EFS /efs ext4 rw,relatime,barrier=
1,data=ordered 0 0
/sys/kernel/debug /sys/kernel/debug debugfs rw,relatime 0 0
/dev/block/vold/179:25 /mnt/sdcard vfat rw,relatime,fmask=0000,dmask=0000,allow_
utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
0 0
/dev/block/vold/179:25 /mnt/extSdCard vfat rw,nosuid,nodev,noexec,noatime,nodira
time,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,s
hortname=mixed,errors=remount-ro 0 0

---------- Post added at 09:31 PM ---------- Previous post was at 09:07 PM ----------

okay after a few checks gameloft download there games to external sdcard market works and hack works from boot with no extra app e.g smanager
[Galaxy Tab 2 7" Android Development] rickwyatt:
i played nova 3 form sdcard last night everything was good i have the full 4.5gb for /data mtp works will upload it people what just let me no
[Galaxy Tab 2 7" Android Development] Japany:
Is it possible some one to make a flashable zip with the script?

Send from my GT-P3110 with CM9
[Galaxy Tab 2 7" Android Development] CXENTE:
@ OP. Will the script, work with the official JB update (India jb leak) ... .. I will try it tonight.. if you haven't :cool:

I can confirm, that it works with stock 4.1.1 JB. :thumbup::D:beer:
[Galaxy Tab 2 7" Android Development] rsage:
Will your solution work on p3113 rooted stock ROM? What would the steps be?
[Galaxy Tab 2 7" Android Development] philupjfry:
I would love the steps. Or maybe just a easy zip...please:)
[Galaxy Tab 2 7" Android Development] Japany:
Is it possible some one to make a flashable zip with the script??? Any answers?
[Galaxy Tab 2 7" Android Development] CXENTE:
The steps are very easy,. As mentioned by the OP ;)
[Galaxy Tab 2 7" Android Development] rsage:
Maybe I'm missing something... the OP seems to be a work in progress and doesn't contain a list of definitive steps. I think DivinityCycle did list some steps elsewhere in the thread, but some users reported that they lost access to the internal memory (or something to that effect). rickwyatt then posted that he got it to work, but it looks like (if I'm reading his posts correctly) he had to take additional measures to get it to work.

So I'm wondering if perhaps the first post can be updated with a clear set of steps, compiled from posts throughout this thread?

Thanks to everyone for all their work on this by the way!

---------- Post added at 11:32 AM ---------- Previous post was at 11:20 AM ----------

rickwyatt, it's great that you got this working on stock - exactly what I'd like to do. Thanks for offering to upload your work - would you be able to do that, or at least share the specific steps you took? Thanks!
[Galaxy Tab 2 7" Android Development] rickwyatt:
will upload a update.zip tonight but i everyone that whats tyis is to first back up your rom i

iv been using it for a week and all good so far
[Galaxy Tab 2 7" Android Development] primetime34:
Any chance of that zip? Thanks
[Galaxy Tab 2 7" Android Development] lhrt:
Super APPS2SD

Guys,

I saw a post on Galaxy note 10.1 forums. The Super apps2sd may be resolve the issue of lack of storage space.

Thanks

Lhrt
[Galaxy Tab 2 7" Android Development] lorenzo_btbw:
I'll give it a try
[Galaxy Tab 2 7" Android Development] primetime34:
Link for the app?
[Galaxy Tab 2 7" Android Development] lhrt:
http://xdaforums.com/showthread.php?t=1888986
[Galaxy Tab 2 7" Android Development] lhrt:
Waiting for the update.zip
[Galaxy Tab 2 7" Android Development] joemilan:
you will make a flashable zip for JB rom?

Thank you very much
[Galaxy Tab 2 7" Android Development] Paulx10:
Far to confusing for me....might just have to start saving and get a diffrrent tab that already has this (basic function) already on.STUPID SAMSUNG,! Why why why make simple things like this so bloody complicated!
[Galaxy Tab 2 7" Android Development] pbanj:
http://xdaforums.com/showthread.php?t=1961097

really not that hard to do
[Galaxy Tab 2 7" Android Development] nycdave:
im a little confused about this thread. If I am understanding this correctly will this enable us to set up the ext card as though it were the stock setting for "sdcard" the same way it is on samsung phones thus allowing us to install apps and whatnot on the sdcard and freeing up all internal storage?

also is there an official zip file that can be applied in recovery?

thanks
[Galaxy Tab 2 7" Android Development] DivinityCycle:
I no longer own a GT 2 7", so I'm not going to be updating this thread anymore, but basically if you're confused I would highly recommend you NOT attempt this modification, as it's possible to mess things up fairly easily if you don't know what you're doing.
[Galaxy Tab 2 7" Android Development] rareness4:
this has been amazing for my Tab

Sent from 2033 GTab2
[Galaxy Tab 2 7" Android Development] Xintorrim:
Please, I need help doing that.
[Galaxy Tab 2 7" Android Development] cheddar122001:
Hello there, I've just rooted my gtab 2 7.0 and need help. So what I'm trying to do is to be able to install games on my 16gb micro ad cars instead of the internal memory. I have link2sd and have partitioned my 16gb micro as card in half. Please help, and thanks in advance.
[Galaxy Tab 2 7" Android Development] nycdave:
This mod only works with the stock rom. Dont waste your time with a custom rom if you want this mod to work. I was abel to get it working flawlessly but only with the stock sammy ics rom after several attempts with like 4 different roms.
[Galaxy Tab 2 7" Android Development] daventodd123:
If you want apps and their data in your ext SD card, Google "link2sd tutorial". I'm using that now and it works like a charm.
[Galaxy Tab 2 7" Android Development] Xintorrim:
Which ROM do you have it running on?
[Galaxy Tab 2 7" Android Development] daventodd123:
CM10, currently. I wanna wait for CM10.1 to fix a few bugs before I move over to that ROM. It should work on any other ROM considering that it deals mainly with your extsdcard.
[Galaxy Tab 2 7" Android Development] Xintorrim:
When I try to use link2sd it says that no second partition is availabe on my ext sd card, though i've created one. Are you sure it works with new jelly bean ROMs?
[Galaxy Tab 2 7" Android Development] daventodd123:
I'm on a Jelly Bean ROM.. Make sure that both partitions are FAT32, as I have had problems with other partition-types.
[Galaxy Tab 2 7" Android Development] nycdave:
my brother thank you so much for this.... when I searched though obviously I got 1000000000 results. any chance you can provide the link that you used?? thanks again!!
[Galaxy Tab 2 7" Android Development] daventodd123:
Here is the dev's topic on Link2SD. The tutorial is about half way down the post.
[Galaxy Tab 2 7" Android Development] Xintorrim:
I linked some apps to ext. SD card but when I rebooted they had disppeared from the tablet. I'm pretty sure they are inside my ext card 2nd partition, but how can I use them if they vanished from my screen?
[Galaxy Tab 2 7" Android Development] daventodd123:
That's weird. I just rebooted my tab and my linked apps are still there.. Was it a few particular linked apps or all of your linked apps?
[Galaxy Tab 2 7" Android Development] Xintorrim:
I've actually managed to work it out, but now I've stumbled upon another problem ('-' -_- ) when I try to link new apps to SD card. Check the image out please and tell me if you know what to do.
[Galaxy Tab 2 7" Android Development] daventodd123:
I've googled your error code and many people have found that a simple reboot helps. Others, which is much more drastic, have had to format their sdcards and reformat the partitions for it to work. Personally, I've never had this error. What partition-types are your partitions? What sizes are they?
[Galaxy Tab 2 7" Android Development] Xintorrim:
Great news, solved my problem with a tool on Link2sd itself. Tapped menu buttom, clicked More and then selected Recreate Mount Scripts. Just had to choose the partition type again and reboot. Thanks for the help anyway.
[Galaxy Tab 2 7" Android Development] eagle0042:
I've seen people recommend various apps that do symlinking on some level, or run a script on boot. Personally, I'm not too fond of installing additional apps that run in the background or on boot. Is there a simple zip file to flash in recovery? I'm already running a custom ROM, AOKP, so I don't think there would be any kernel compatibility issues like stock.

I've looked through some forum threads dealing with this, but I haven't found a generic zip file to flash.

On a previous device running cm7, swapping mount points was as easy as checking a box in the settings.
[Galaxy Tab 2 7" Android Development] nycdave:
Thhe reason why you havent found one is because there is not one that I have seen. This method works very well and it wont mess anything up for you. Ican appreciate your apprehension but it does work with this tab as long as you are running a stock rom. Good luck!
[Galaxy Tab 2 7" Android Development] sullytrny:
Works great, stock 3113

KFHD 8.9 - GT-P3113 - XT912
[Galaxy Tab 2 7" Android Development] daventodd123:
Wow, 5gbs of apps? What do you have on your tab that's so large? Haha
[Galaxy Tab 2 7" Android Development] eagle0042:
Thanks! Yeah, I'm running AOKP. So far, the only way I have got it to work was using script manager on boot. Yep, it works great, just not my preferred solution.

I seen where DivinityCycle did userinit script for cm10, that could be flashed in recovery, but oddly enough, it didn't work for me on AOKP. I'm pretty certain AOKP supports userinit scripts, but I don't know why it didn't work. I might compare the script that I'm currently using, and the cm10 script to see the differences. I'll post if get it to work via recovery.

EDIT: From what I can see, AOKP doesn't support userinit.sh scripts. At least not out of the box.
[Galaxy Tab 2 7" Android Development] voldomart13:
Installed on cm10 works like a charm! thank you so much!