yashsingh1/xdaforums huggingface dataset:
[Galaxy Tab 2 7" Android Development] CYBERFANT:
I have the same Problem on my Galaxy Tab2 7.0 WIFI (GT-P3110 8 GB). I found a temporary Soloution for me. The App that i use is LINK2SD. You should have two partitions on SD card and both should be primary.

The first FAT partition is your standard sdcard (mountetd on extSdCard). The second partition /data/sdext2 is used for application files and can be ext2, ext3, ext4 or FAT32. Here are more informations about it: http://rootzwiki.com/topic/24500-if...move-apps-to-sd-card/page__st__10#entry701146

In this thread are the same Question: http://xdaforums.com/showthread.php?t=1679037
[Galaxy Tab 2 7" Android Development] RomsWell:
I think it will read the changes. For example on the htc rezound the firmware update for ics changed the mount points from what was used in gb.So in order to run a gb Rom on ics firmware and vice versa the Fix was swaping vstab. Figure as long as u only mess with the sd mounts internal and ext. It will still boot and u can swap file as needed for testing.
[Galaxy Tab 2 7" Android Development] DivinityCycle:
I'll try and figure it out.

Already found one thing: running the mount command with no switches will list all current mounts (can't believe I forgot that!).
[Galaxy Tab 2 7" Android Development] RomsWell:
Im workin on it too. Im used to seeing them on separate lines. Ill let u know if i beat ya to it lol
[Galaxy Tab 2 7" Android Development] DivinityCycle:
Something else useful that I found:

root@android:/dev/block # cat /proc/partitions
major minor #blocks name

179 0 7634944 mmcblk0
179 1 20480 mmcblk0p1
179 2 2048 mmcblk0p2
179 3 2048 mmcblk0p3
179 4 8192 mmcblk0p4
179 5 8192 mmcblk0p5
179 6 8192 mmcblk0p6
179 7 716800 mmcblk0p7
259 0 20480 mmcblk0p8
259 1 1433600 mmcblk0p9
259 2 4886511 mmcblk0p10
259 3 524288 mmcblk0p11
179 16 2048 mmcblk0boot1
179 8 2048 mmcblk0boot0
179 24 30318592 mmcblk1
179 25 30314496 mmcblk1p1

and

root@android:/dev/block # df
Filesystem Size Used Free Blksize
/dev 347M 48K 347M 4096
/mnt/asec 347M 0K 347M 4096
/mnt/obb 347M 0K 347M 4096
/system 1G 259M 1G 4096
/data 4G 2G 2G 4096
/cache 688M 58M 630M 4096
/efs 19M 4M 15M 4096
/mnt/extSdCard 28G 13G 15G 32768
/mnt/sdcard 4G 2G 2G 4096

I'm pretty sure the partitions listed are found at /dev/block/mmcblk0pX, so maybe that's what needs to be mounted. I've not been successful yet in mounting anything manually but I just found this stuff, so hopefully will have it soon.
[Galaxy Tab 2 7" Android Development] rostol:
Hey DivinityCycle,

This post and tool in the S3 forum might be useful to you as it does the exact same thing in the GS3.

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

If I recall correctly it needs a kernel with init.d support. But I think it will definitely help.

Rgrds

Sent from my GT-I9300
[Galaxy Tab 2 7" Android Development] RomsWell:
I have this in mine i didnt see it in yours

#storage_struct = series, "/mnt/sdcard/extStorages"

#storage_struct = parallel
[Galaxy Tab 2 7" Android Development] DivinityCycle:
Making progress, I was able to mount the "external" sdcard to my test mountpoint using:

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

So, that's part of the puzzle figured out. Now, just need to sort of out the internal "sdcard" device path and then I guess I can try throwing stuff into vold.fstab :)
[Galaxy Tab 2 7" Android Development] DivinityCycle:
OK I believe I have a solution will work, based on the init.d script inside the package Mattiadj made and Rostol linked me to (thanks!).

I modified his init.d script likeso:

sleep 2
mount -o remount,rw /
mkdir -p /data/internal_sd
mount -o bind /mnt/sdcard /data/internal_sd
mount -t vfat -o umask=0000 /dev/block/vold/179:25 /mnt/testing
mount -o bind /data/internal_sd /mnt/extSdCard

vold has to be used for external storage. The internal storage isn't very flexible, which is why that guy's script just binds it up during boot time rather than some other method of mounting it.

I have just run the commands in a terminal one by one and they all appear to do exactly what they "should", and I have verified that the result is the "real" sdcard being mounted to /mnt/sdcard, which ALSO makes it accessible at /sdcard (which I think is just a symlink). That's the default target for most apps, so after installing this init.d script I think everything should "just work".

Obviously you could adjust the mount point for the "internal" sdcard space as needed.

Working on the script and installation bit now.
[Galaxy Tab 2 7" Android Development] RomsWell:
/mnt/sdcard

/dev/fuse fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other

---------- Post added at 11:55 PM ---------- Previous post was at 11:54 PM ----------

Nice :)
[Galaxy Tab 2 7" Android Development] DivinityCycle:
OK I am having some problems getting the init.d script to work properly.

My working code is:

#!/system/bin/sh
LOG=/data/local/tmp/sdcard.txt
exec 3>&1 4>&2 >$LOG 2>&1
echo "Script start"
echo "Sleeping 2 seconds"
sleep 2
echo "Now attempting to remount root filesystem RW"
mount -o remount,rw /
echo "Make the internal_sd directory"
mkdir -p /data/internal_sd
echo "Bind the internal sdcard to the new folder"
mount -o bind /mnt/sdcard /data/internal_sd
echo "Mount the real sdcard"
mount -t vfat -o umask=0000 /dev/block/vold/179:25 /mnt/sdcard
echo "Bind the internal_sd directory to the extSdCard mountpoint"
mount -o bind /data/internal_sd /mnt/extSdCard
echo "Script done"

Basically I am logging the output to /data/local/tmp/sdcard.txt, so I can debug.

In that log, it gets as far as the first mount command, and then things go off the rails:

Script start
Sleeping 2 seconds
Now attempting to remount root filesystem RW
Make the internal_sd directory
Bind the internal sdcard to the new folder
mount: Invalid argument
Mount the real sdcard
mount: No such file or directory
Bind the internal_sd directory to the extSdCard mountpoint
Script done

What's messed up is, the same mount command (with the bind) works fine once the device is all the way booted up.

Its just during the "init" sequence that it has a problem. I have no idea why :(
[Galaxy Tab 2 7" Android Development] Maximinus I:
We had a similar thing for my Droid x2. You my want to check out this thread http://xdaforums.com/showthread.php?p=16875467 and contact the dev.
[Galaxy Tab 2 7" Android Development] DivinityCycle:
That guy did it via vold.fstab, which is interesting.

The relevant stuff:

# external sd card
dev_mount sdcard /mnt/sdcard:none:lun1 auto /devices/platform/tegra-sdhci.2/mmc_host/mmc2 /devices/platform/tegra-sdhci.2/mmc_host/mmc1

# internal eMMC
dev_mount sdcard_ext /mnt/sdcard-ext 18 /devices/platform/tegra-sdhci.3/mmc_host/mmc0

I am honestly not too sure what I'm looking at there, so I'm gonna try some stuff in vold.fstab next.
[Galaxy Tab 2 7" Android Development] DivinityCycle:
OK, I am too tired to keep messing around with this for tonight, so I am trying out a new method: I moved my init script over to /data and then used Script Manager to make it run as root as boot time.

This is obviously not a permanent fix, but should be OK for tonight.

Basically my big problem is I don't know the syntax for vold.fstab to mount the internal sdcard to a new mount point...
[Galaxy Tab 2 7" Android Development] DivinityCycle:
Ahh the joys of doing weird hacky stuff to your tablet... I pretty much gave up on the vold.fstab working in the short term, and instead just tried setting my init script up as just a regular "run at launch" script using Script Manager.

The version of my script that I posted had unforeseen consequences. For whatever reason, doing a "bind" of /mnt/sdcard like I was doing caused all sorts of things to stop working. Like, Script Manager was locking up, as was Root Explorer!

The best one was that when my alarm clock went to go off this morning it crashed, and I was late for work! LOL

Sooo yeah, that's pretty special. I had to use Terminal Emulator to fix my stuff on the bus on the way to work :P

I have revised my script and it now works perfectly with the caveat that I'm simply unmounting the internal "sdcard" partition and letting it sit there unused.

#!/system/bin/sh
LOG=/data/local/tmp/sdcard.txt
exec 3>&1 4>&2 >$LOG 2>&1
echo "Script start"
echo "Unmount internal sdcard"
umount /mnt/sdcard
echo "Mount the real sdcard"
mount -t vfat -o umask=0000 /dev/block/vold/179:25 /mnt/sdcard
echo "Script done"

I believe because of vold.fstab the microSD card still gets mounted to /mnt/extSdCard. My script puts it at /mnt/sdcard as well. This seems to work OK because then the few programs that are smart enough to access the card via /mnt/extSdCard still can get to it, but everything else that works on the regular sdcard also goes to the sdcard as well.

I have tested out the camera, music player, Root Explorer, Script Manager, etc. Everything I have tried works exactly as expected.

The next thing I'll need to test out is if this script can be used as an init.d script instead of needing Script Manager to set it up to run at boot.

I figure the only other things to do are:

1-figure out what's needed to be able to mount the internal "sdcard" partition to a different mount point

or

2-figure out how to delete the "sdcard" partition and then just give that extra space to one of the other flash partitions (probably /system?)
[Galaxy Tab 2 7" Android Development] azturbomini:
I really am hoping you get this figured out and it can be used by us common folk. (I'm no hacker) Lol :thumbup:
[Galaxy Tab 2 7" Android Development] DivinityCycle:
Wow, while working on my init.d script, I managed to make my system freeze at the bootup animation. I "unlocked" things by reflashing my ROM.

Good thing its a slow day at the office...
[Galaxy Tab 2 7" Android Development] pbanj:
i really hope u can get this working, would love it
[Galaxy Tab 2 7" Android Development] mikka005:
I mean for ex HD widgets or any other...
[Galaxy Tab 2 7" Android Development] Caldair:
Ah, OK. I can't speak about HD widgets because this is not something that I use. But the conventional widgets that i have used are working great. Both on my home and lock screens!:D
[Galaxy Tab 2 7" Android Development] m4rk:
Doesn't this leave your / and /system mount points in rw mode?
[Galaxy Tab 2 7" Android Development] panachoi:
I'm still confused. I've read through this entire thread, and am not sure how/what to do to get this working on CM 10.1 (RC5)....

Any help appreciated.
[Galaxy Tab 2 7" Android Development] Skazzy3:
Maybe because this won't work on CM 10.1

use folderrmount. its your best bet.
[Galaxy Tab 2 7" Android Development] vadbess:
any ideas for CM 10.1?
[Galaxy Tab 2 7" Android Development] Skazzy3:
look one post above yours.
[Galaxy Tab 2 7" Android Development] vadbess:
i don't like foldermounts

and i have a some progress: in this forum i download Download ExtSd2InternalSd for gs4 fat32 and took a script and do a not much changes. Than when i plug my tab to PC in My Computer show my MicroSD instead of Internal, but in tab nothing has changed. May be it's help to developing
[Galaxy Tab 2 7" Android Development] Skazzy3:
...

The tab always shows micro sd in usb if its inside the tab.

Foldermount is the only thing you can use for 4.2.2 so you can only use that.
[Galaxy Tab 2 7" Android Development] CXENTE:
:( this low storage thing, is killing me :banghead:
[Galaxy Tab 2 7" Android Development] poulsen93:
I've been playing around with your script and it work perfect, after boot. The sleep command is of no use as it delays the entire boot process, so it needs to be started further into the boot process . I just hope someone can help delaying it.
[Galaxy Tab 2 7" Android Development] DivinityCycle:
yeah, it seems to work fine if run as a "boot up" script initiated by Script Manager. If I set it up as an init.d script then it doesn't work, I get errors.

I'm going to test out some stuff.

Running the mount command with no options results in a listing of all presently-mounted file systems, so I think it'd be helpful to run on of those from init.d and examine the results.

I haven't worked on it in a couple days cuz I was off work and taking it easy. However, now its back in the saddle!
[Galaxy Tab 2 7" Android Development] RomsWell:
"/dev/block/mmcblk0p5") "boot.img",

("ext4", "EMMC", "/dev/block/mmcblk0p9", "/system")

("ext4", "EMMC", "/dev/block/mmcblk0p10", "/data")

/dev/block/mmcblk0p7 Cache

This match what youve come up with so far? Not really workin on the sd swap since uve got it :P But im trying to list all the mount point/partitions for Updater ease. I'm sure of all but cache
[Galaxy Tab 2 7" Android Development] DivinityCycle:
I'm hoping this will help me get this sorted. I didn't get any work at all done on this today, since work was busy, but hopefully tonight / tomorrow I'll get something useful done :D

This community rocks!
[Galaxy Tab 2 7" Android Development] RomsWell:
I'm matching block count to try and figure it out. Hopefully tomorrow I can have a complete list

---------- Post added at 11:53 PM ---------- Previous post was at 11:36 PM ----------

mmcblk0p5 Boot

mmcblk0p9 System

mmcblk0p10 Data

mmcblk0p7 Cache

mmcblk1p1 Ext SD

mmcblk0p1 EFS

Not sure how many more i can match up like that. and i have yet to test mount to see what it brings. So careful till tested :) Well i know system and data are good :p
[Galaxy Tab 2 7" Android Development] DivinityCycle:
Well alllrighty then... I just did used a modified version of my init script to just run "mount" and readout all the mountpoints that are active during the device's init. Here's what I got:

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 rw,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,errors=panic,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

Yeah, in case you didn't notice, no sdcard is listed, meaning its not mounted at the time the script gets executed. It logically follows that /mnt/sdcard is mounted automatically by some other process. I am presently researching where this comes from in the boot up cycle (so I can figure out what to modify :P)
[Galaxy Tab 2 7" Android Development] poulsen93:
Try and use .logcat from Play store (free) and see if you can make use of that, there is properly something there.
[Galaxy Tab 2 7" Android Development] DivinityCycle:
It looks like the /init.rc stuff is where the action is. It's a little confusing cuz there's like 4 scripts that init.rc imports, which means 4 scripts to look at / attempt to understand LOL. Still, I found where the sdcard mount points are made. Haven't found the actual part where the system mounts up sdcard yet, but its making more sense now.

-EDIT-

Lovely, I just found out that its really not easy to modify the init.rc scripts, since they're stored in the boot image of your ROM and re-extracted from there during boot, so modifying the ones you find at / after boot does nothing :(

Just FYI, the relevant stuff appears to be in /init.espresso.rc, right at the top:

import init.espresso.usb.rc

on early-init
export EXTERNAL_STORAGE /storage/sdcard1
export SECONDARY_STORAGE /storage/sdcard0
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
[Galaxy Tab 2 7" Android Development] stranxk:
I posted some of your info in the extsd2internalsd thread, hope you dont mind, im just trying to get some help.
[Galaxy Tab 2 7" Android Development] DivinityCycle:
No worries, the more info out there the better!

FYI folks, it looks like if you're running any CM-derived ROM, a more "clean" way to do a startup shell script is set one up at

/data/local/userinit.sh or /data/local/userinit.d. Note, that's in the /data partition so its "safe" to install stuff there. As best I can tell, it executes almost around the same time as the init.d, and so far I haven't worked out a way to use that to my advantage yet.

I tried setting the global variables the way the init.rc script does in the hope that maybe they're used a bit further into the boot sequence, but no dice.

Next idea: since it looks like everything is just symlinks that ultimately point to /storage/sdcard0 (internal fake storage) and /storage/sdcard1 (real microSD). And since I know that my script is getting executed BEFORE any of the "sdcard" stuff has mounted up, I'm relatively sure I can just tear down the symlinks that init.rc has built and make my own set that just have the two targets flip-flopped. It sounds like it might work, but so have the last few ideas I have tried :P
[Galaxy Tab 2 7" Android Development] DivinityCycle:
HOLY CRAP I GOT IT!!!!

Sorry, been trying to crack this for like a week.

My present solution is to use simple shell script at /data/local/userinit.sh, which as I previously documented, will auto-execute on CyanogenMod ROMs (running CM10 here ;P).

The "real" mount points for the two "sdcard" items are /storage/sdcard0 and /storage/sdcard1, so what my script does is just remove and re-add all the symlinks with their targets reversed.

#!/system/bin/sh
LOG=/data/local/log.txt
exec 3>&1 4>&2 >$LOG 2>&1
echo "Script start"
echo "Now attempting to remount root filesystem RW"
mount -o remount,rw /
echo "Now attempting to remount /system filesystem RW"
mount -o remount,rw /system
echo "Removing regular symlinks"
rm /sdcard
rm /mnt/sdcard
rm /extSdCard
rm /mnt/extSdCard

echo "Making reversed symlinks"
ln -s /storage/sdcard1 /sdcard
ln -s /storage/sdcard1 /mnt/sdcard
ln -s /storage/sdcard0 /extSdCard
ln -s /storage/sdcard0 /mnt/extSdCard

echo "Script done"

This results in no functional problems with things like automounting and MTP because the underlying mechanisms (fuse and vold) are still working the same, its just the links which are different.

I'm gonna pester Kidney Poker about how to make this script into a flashable .ZIP file for the folks here who may be less than happy with messing around with permissions and stuff, although you really don't need to do anything too fancy to create a script at /data/local. I believe that's read/write by default, so you just gotta throw the script into the directory and make sure its got the permissions (so that its executable).

My current script DOES leave both / and /system mounted in a read/write state, which is on purpose, because during development I really began to appreciate the convenience. You'll want to add some lines to re-mount them as read only if you want.

More to come once I have packaged up this nice little hack so everybody can enjoy their silly 32GB microSD cards :P

And now, to dump a ton of music into my tab...
[Galaxy Tab 2 7" Android Development] poulsen93:
It doesn’t work here, /mnt/sdcard and /mnt/extSdCard are not symlinks on my device, so it fails to remove and recreate them.
[Galaxy Tab 2 7" Android Development] DivinityCycle:
What ROM are you running?
[Galaxy Tab 2 7" Android Development] poulsen93:
I'm running CM9 RC2.
[Galaxy Tab 2 7" Android Development] RomsWell:
I'll be home around 9 est. Won't take long to throw one together.
[Galaxy Tab 2 7" Android Development] DivinityCycle:
That makes things interesting. From the root of the device (you know, just /) can you get me the init.rc files? There's usually like 3 or 4. The ones I found helpful in the codeworkx CM10 were init.rc and init.espresso.rc. I'm not sure what has changed from ICS to JB, but obviously some stuff has.

Really don't wanna go back to ICS now that I got JB all nice :P
[Galaxy Tab 2 7" Android Development] poulsen93:
Here you go
[Galaxy Tab 2 7" Android Development] DivinityCycle:
@poulsen93, That was fast!

Within init.espresso.rc I see this

on early-init
export EXTERNAL_STORAGE /mnt/sdcard
mkdir /mnt/sdcard 0000 system system
mkdir /mnt/extSdCard 0000 system system
mkdir /mnt/usbdisk 0000 system system

# for backwards compatibility
symlink /efs /factory
symlink /mnt/sdcard /sdcard
symlink /mnt/extSdCard /extSdCard

Based on that, its looking like on your ROM, the "real" mount points are right on the root of the filesystem, /sdcard and /extSdCard, so the hacky script I came up with won't be a permanent fix.

The only thing I could do for ya is switch the targets of /mnt/sdcard and /mnt/extSdCard

#!/system/bin/sh
LOG=/data/local/log.txt
exec 3>&1 4>&2 >$LOG 2>&1
echo "Script start"
echo "Now attempting to remount root filesystem RW"
mount -o remount,rw /
echo "Now attempting to remount /system filesystem RW"
mount -o remount,rw /system
echo "Removing regular symlinks"
rm /mnt/sdcard
rm /mnt/extSdCard

echo "Making reversed symlinks"
ln -s /sdcard /mnt/extSdCard
ln -s /extSdCard /mnt/sdcard

echo "Script done"

I'm pretty sure when I was running CM9 a couple days ago I had the same problems, so I'll have to work out an alternate solution for that ROM.

From my research it looks like /storage is a Jellybean thing.
[Galaxy Tab 2 7" Android Development] poulsen93:
Sadly it didn't work, but I'll have a good look at it later, sleep is urgently needed.
[Galaxy Tab 2 7" Android Development] stranxk:
Im running cm9 and this is the log file

Script start

Now attempting to remount root filesystem RW

Now attempting to remount /system filesystem RW

Removing regular symlinks

rm failed for /mnt/sdcard, Is a directory

rm failed for /mnt/extSdCard, Is a directory

Making reversed symlinks

link failed File exists

link failed File exists

Script done
[Galaxy Tab 2 7" Android Development] DivinityCycle:
LOL clearly I'll have to make a backup and then revert to CM9 to see what can be done.

Should be able to do a logic fork in the script for if the path exists and is a directory, cuz I believe it should be possible to unmount / remount.

I need to find a better way to trigger a script later in the boot process, the way Script Manager does it. However I wanna find how to do it without having to install an ad-supported app.

Leaving work now!
[Galaxy Tab 2 7" Android Development] azturbomini:
This is looking very promising! :thumbup::beer::thumbup:
[Galaxy Tab 2 7" Android Development] CXENTE:
This is for jellybean ? Right??
[Galaxy Tab 2 7" Android Development] DivinityCycle:
Yessir, that script works properly under CM10 / Jellybean.

I just factory wiped my tab and rolled back to CM9 so I can figure out how to make it work there.

In semi-related news, I found that part of the Android OS is that you can register an event listener for your app, which lets your app do things when events happen on the system, like WiFi connection and system boot.

The bad news on that is that only actual Android "apps" can do that, I don't think there's a way to do that via simple shell scripting.

That would suck because ideally I'd like to just package the script up in a flashable ZIP so you can easily "apply" it at the same time you flash ROMs. This is definitely do-able with my current Jellybean solution, but I'll need to dig into ICS / CM9 to see if I can figure it out on there.

That's on the agenda for tonight :P