[Q] mount -o bind at boot on stock rom - Galaxy S II Q&A, Help & Troubleshooting

Hi !
I have an application (CamScanner) with large amount of data (~8Gb). This app doesn't support transfering data do external SD card, so I checked mount -o bind command to bind directory with data stored on external SD to directory in /sdcard and it's working correctly. Question is where I can put this command so that system will run it at boot time after external sd card is ready. There is no /etc/init.d directory on my SGS2 (stock XXKI4). I prefer not to install any applications to perform such a simple task...
Thanks for help, regards !

slig said:
I prefer not to install any applications to perform such a simple task...
Click to expand...
Click to collapse
I think you have no choice, as stock kernels do not have init.d support. You'd need to go down the route of either using an app to run a script on boot, install a kernel with init.d support, or stick with your current method of manually running a script when you need to use the app.
Also, you could try asking the developers kindly to allow saving to external_sd. There's an Email Developer link on the Android market, and a Contact Us link on their website

Thanks for response. I found script named init.rc located in "/", it has several mount commands inside, wonder if it can be used...
Also discovered that app Tasked has ability to run shell scripts with root privileges (at boot or at application start). I suppose I have to put this shell script in /system because in /sdcard owner permissions cannot be set so that file cannot be modified (vfat does not support that) and a security hole would be created...
I think that I'll also ask developer for this feature as You suggest.

slig said:
Thanks for response. I found script named init.rc located in "/", it has several mount commands inside, wonder if it can be used...
Click to expand...
Click to collapse
Everything in "/" is initramfs, a volatile ramdisk changes to which would be lost
on reboot. Only exception are directories in which actual partitions are mounted,
like /system and /data (you can check which directories with "mount" command).
Have you tried just using symbolic link?
INFO
This may be the best solution, try something like:
Code:
mkdir /sdcard/AppFolder
ln -s /sdcard/AppFolder /data/data/com.your.application.data.folder
Just in case you don't know, you can execute those command using
Terminal Emulator. You were considering modifications to /, so I guess you already have root.

Yes, I have rooted my SGS2 via ZergRush.
I didn't know that / is volatile initramfs, thanks for that information.
As for symbolic link - unfortunately on my stock ROM both /sdcard and /sdcard/external_sd filesystems are vfat and don't support symbolic linking. Only working way I discovered is bind mount.
In my case, I have the following:
mount -o bind /sdcard/external_sd/CamScanner /sdcard/CamScanner
And application runs OK, all data is accessible and doesn't consume internal flash memory.
I'll take a look how hard would be to write some small application to do just this task - define some pairs of source and target directories and mount - bind them at start.

I've somehow missed the fact that you're need redirection from /sdcard
to /sdcard/external_sd, I was thinking about symlink on /data...
Anyways, there another nice trick you can do - if you can devote your SD card
to this one application, then just edit /system/etc/vold.fstab to make SD card
mount in /sdcard/CamScanner instead of /sdcard/external_sd.

Related

[EXPANDSD] Join your external SD with internal SD!

WARN: For developer only.
attachment is the EXPANDSD script.
Why use it?
So many applications use /sdcard for mass data storage(gameloft, navigation...),
but I9100's internal_sd size is limit to 11G, so we need external_sd's space.
But these applications dosen't know how to use external_sd, old method is hack the apk for external_sd, but this will change apk's signature, and need smali/baksmali to work. My method work in system level, don't need change any apk file.
How to use:
1.make expandsd.ownhere dirctory in external_sd root directory.
2.move internal_sd's directory(for example:/gameloft) to expandsd.ownhere
3.run init_expandsd.sh
Theory:
use 'mount --bind' feature, bind external_sd's dir to internal_sd.
Because the sd card using fat32 partition format, the 'ln -s' command does not work, so the "mount --bind" is the only way to dynamically change the directory content.
Hi mate,
Thks for your shares. I have a question. How run init_expandsd.sh?
I tried gscript and init.d, but doesn't seem to be working
woohoo a great dev has come. glad you got here mate! love your work on Desire section.
harrynghiem said:
Hi mate,
Thks for your shares. I have a question. How run init_expandsd.sh?
Click to expand...
Click to collapse
you can try to use terminal emu, just type su then navigate to folder where the script located, then type sh init_expandsd.sh then enter. this might do the trick to execute .sh
dexterdave said:
you can try to use terminal emu, just type su then navigate to folder where the script located, then type sh init_expandsd.sh then enter. this might do the trick to execute .sh
Click to expand...
Click to collapse
Does it work for you?
It's a great idea thanks a lot for your work. I was wondering why ln was not working.
But too bad it does not work for me, i get the following error :
[1] Segmentation fault
Do you have any idea why ?
Thanks again
problems when connecting phone to pc
hi,
tried the "mount --bind" in order to try your script.
works fine. the directory contents is shared between the 2 path's,
but i have a problem when i connect the phone to a pc.
when i try to disconnect, the sdcard and external_sd are not
available anymore until i reboot the phone
note: the commands that i have executed are:
Code:
mkdir /mnt/sdcard/external_sd/foo
echo "test" > /mnt/sdcard/external_sd/foo/test
mkdir /mnt/sdcard/foo
mount --bind /mnt/sdcard/external_sd/foo /mnt/sdcard/foo
Can this script be placed in init.d folder for autorun at boot?
Edit: sorry, already answered above: no, it cannot.
Sent from my GT-P1000 using Tapatalk
Seems abandoned by @ownhere
Sent from my GT-I9100
Idan73 said:
Seems abandoned by @ownhere
Sent from my GT-I9100
Click to expand...
Click to collapse
too bad, it could be very useful..
TheFirstBen said:
It's a great idea thanks a lot for your work. I was wondering why ln was not working.
But too bad it does not work for me, i get the following error :
[1] Segmentation fault
Do you have any idea why ?
Thanks again
Click to expand...
Click to collapse
got the same problem please help
How to use?
ownhere said:
WARN: For developer only.
attachment is the EXPANDSD script.
Why use it?
So many applications use /sdcard for mass data storage(gameloft, navigation...),
but I9100's internal_sd size is limit to 11G, so we need external_sd's space.
But these applications dosen't know how to use external_sd, old method is hack the apk for external_sd, but this will change apk's signature, and need smali/baksmali to work. My method work in system level, don't need change any apk file.
How to use:
1.make expandsd.ownhere dirctory in external_sd root directory.
2.move internal_sd's directory(for example:/gameloft) to expandsd.ownhere
3.run init_expandsd.sh
Theory:
use 'mount --bind' feature, bind external_sd's dir to internal_sd.
Because the sd card using fat32 partition format, the 'ln -s' command does not work, so the "mount --bind" is the only way to dynamically change the directory content.
Click to expand...
Click to collapse
thanks,
this is genius
I'm not using your script (have myself some ux & scripting skills) but did not know about the -bind option on android
Ridiculously simple and efficient
Did it my own way and it works great
Thanks a lot for this
dawabz94 said:
thanks,
this is genius
I'm not using your script (have myself some ux & scripting skills) but did not know about the -bind option on android
Ridiculously simple and efficient
Did it my own way and it works great
Thanks a lot for this
Click to expand...
Click to collapse
Then why not share with us please !
Let us know how you did
Yes I'd like to know another method also.!
Sent from my GT-I9100 using XDA
Chairmansaab said:
Then why not share with us please !
Let us know how you did
Click to expand...
Click to collapse
Hi,
it's very easy indeed, once you got the point.
I do most of my stuff using an "adb shell" session so I'll post here my steps to get it working.
Also I like simple implementation so my script is the strict minimum needed to mount necessary folders
I assume you have a rooted device with working busybox and a kernel that supports /etc/init.d/
I suggest you do the test on a dummy folder before applying on a real folder.
So start by creating a folder called /sdcard/dummy
Do it the way you want , I do it with an "adb shell" session
Code:
cd /sdcard
mkdir dummy
Then copy some files in it (photos for examples)
Code:
cd /sdcard
cd DCIM
cd Camera
cp `ls -1 |tail -5` /sdcard/dummy
From now on, we consider we want to move transparently /sdcard/dummy to the external SD
1. move the folder to the external sd
CAUTION : I'm running a CM9 rom => my external sd is mounted on /mnt/emmc
Standard samsung sdcard mount is /sdcard/external_sd
The path might be different according to your brand and rom
Moving the folder code
Code:
cd /sdcard
mv dummy /mnt/emmc/
2. Create the mount point in the indernal SD
Code:
cd /sdcard
mkdir dummy
3.a Check the mount is successful by manually doing it
Code:
mount --bind /mnt/emmc/dummy /sdcard/dummy
3.b Check you see exactly the same thing on both folders
Both commands should return exactly the same output
Code:
ls -l /sdcard/dummy
Code:
ls -l /mnt/emmc/dummy
If everything is fine, then you're good to go
4. Automate mount at boot time
Create a script in /etc/init.d to automate the mount at boot time
I personally use "vi" but most people prefer graphical UIs, I can't recommend any here, do it your own way
So basically you would go root,remount /system in read/write mode and create the file
Code:
su
mount -o remount,rw /dev/block/mmcblk0p9 /system
cd /etc/init.d
vi 90binds
Insert following lines, save and exit
Note that the "sleep 60" is to let the system boot up before mounting partitions (thanks to the initial script shared here)
Code:
#!/system/bin/sh
sleep 60
mount --bind /mnt/emmc/dummy /sdcard/dummy
Change owner and permissions, flush disk cache and remount /system in read only
Code:
su
mount -o remount,rw /dev/block/mmcblk0p9 /system
cd /etc/init.d
chown root:shell
chmod 6755 90binds
sync
mount -o remount,ro /dev/block/mmcblk0p9 /system
To check, run
Code:
su
cd /etc/init.d
ls -l 90binds
The output should look like this :
Code:
-rwsr-sr-x 1 root shell [I]0 MMM D HH:MM[/I] 90binds
5. Now you can reboot and check - after reboot - that the mount is done
Both commands should return exactly the same output (always ran in an "adb shell" session)
Code:
ls -l /sdcard/dummy
Code:
ls -l /mnt/emmc/dummy
6. Now you're good to move other folders
Basically, you move the folder to external SD
Create the mount point on the internal SD
Append the mount command in the 90binds script
And that's it
Hope this helps
---------- Post added at 11:09 AM ---------- Previous post was at 11:04 AM ----------
benc88 said:
Yes I'd like to know another method also.!
Sent from my GT-I9100 using XDA
Click to expand...
Click to collapse
Just posted
Take time to read and understand the idea

Using all of the NTs storage

I posted this in the nook touch forum by mistake. Please read below and let me know what you think.
One of the biggest issues I had with my nook was the 16/1GB division between content I can load and content from B&N/etc. Not being able to use that 16GB how I wanted was something I set forth to fix. Here is my solution to make this usable to non-rooted apps.
1) Root if not already rooted.
2) Make a directory inside of /data. I chose /data/usrdata.
3) remount / as RW with the command mount -o remount,rw -t rootfs rootfs / (credit to Indirect for this, as I could't find the command to do so)
4) mkdir /mnt/internal . We need somewhere to mount /data/usrdata/ and /mnt is public enough.
5) busybox mount -o bind /data/usrdata /mnt/internal. Mounts /data/usrdata to /mnt/internal.
6) For good measure, chmod 777 /mnt/internal and chmod 777 /data/usrdata.
Now, /mnt/internal should have whatever free space /data has, and should be read/write accessible from any program. A quick test with touch+terminal emulator shows new files as being created with RW permissions for all.
Alternatives: When I was initially thinking about ways to do this, my first reaction was to just open up /data to be read only to all, then have my usrdata folder be read/write all. However, I know part of android's app security model depends on some of these permissions. While I can't think of anything breaking or sensitive data being leaked, I decided against it. If anyone has any thoughts as to that scenario, I am very interested in hearing about it.
USB support: This will *not* be mountable under USB. Unfortunately you are still limited to transfering the data from a computer to the B&N internal storage or SDcard first, then moving the data internally. The problem that I see with this is similar to my understanding of the galaxy nexus situation, where the system can't unmount its /data partition and let the USB host take over. Another alternative to this could be to write an image file and mount that over usb (I've done this on my Evo, it worked so-so). Problem with that is that it really wouldn't grow/shrink with the storage. I suppose you could do some shell trickery and pipe it through gzip somehow, but that wouldn't help very much.
Let me know what you think and if you have any ways to improve this.
UPDATE: Persistance:
To make this persistant across reboots, run these commands as root:
1) mount -o rw,remount -t ext4 /dev/block/platform/mmci-omap-hs.1/by-name/system /system
2) echo mount -o remount,rw -t rootfs rootfs / >> /system/bin/clrbootcount.sh
3) echo mkdir /mnt/internal >> /system/bin/clrbootcount.sh
4) echo busybox mount -o bind /data/usrdata /mnt/internal >> /system/bin/clrbootcount.sh
5) echo mount -o remount,ro -t rootfs rootfs / >> /system/bin/clrbootcount.sh
All this does is put the following at the end of clrbootcount.sh
mount -o remount,rw -t rootfs rootfs / #Remounts root as RW. Root is regenerated at each reboot, so /mnt/internal is never going exist on a fresh startup
mkdir /mnt/internal #make /mnt/internal, see above
busybox mount -o bind /data/usrdata /mnt/internal #Binds the directory
mount -o remount,ro -t rootfs rootfs / #remounts root as RO. Unsure if this is necessary, but since it runs as RO, its probably better safe than sorry.
Thanks to eded333 for mentioning a good place for the script.
Click to expand...
Click to collapse
I was the one who wrote the script gameman. >.>'
Very nicely done.
Does Android possess a fstab? If so, could these changes (also) be made there and still be persistent?
this is a good work around
Am I understanding this correctly in that if I follow these guidelines I can move my data over to the Barnes and noble alotted storage that we were complaining about not having available?
Sent from my Nook Tablet using Tapatalk
downsay said:
Am I understanding this correctly in that if I follow these guidelines I can move my data over to the Barnes and noble alotted storage that we were complaining about not having available?
Sent from my Nook Tablet using Tapatalk
Click to expand...
Click to collapse
That is correct, from what I understand as well.
Sent from my BNTV250 using Tapatalk
liquidzoo said:
Very nicely done.
Does Android possess a fstab? If so, could these changes (also) be made there and still be persistent?
Click to expand...
Click to collapse
From what I could tell, it does, but its not the normal /etc/fstab. It looks like they have a daemon or something that mounts the sdcard and the media (1gb) drive. When I first looked at its version of the fstab, it looked like it only took a block device, which doesn't quite work for the directory binding.
downsay said:
Am I understanding this correctly in that if I follow these guidelines I can move my data over to the Barnes and noble alotted storage that we were complaining about not having available?
Click to expand...
Click to collapse
Yes that is correct. You still cannot mount it under USB, however. If you have some other way of getting the files there, however, its open as an option. I've been using swiFTP (in the market) to do that. Could also copy and move from the media/sd cards that do mount to the PC, but thats a two step process. I've thought about getting MTP setup so that you can see that folder via USB, but haven't really had a chance to look into how that would work.
*Note, when using swiFTP and other programs more than likely, you may get some file permissions errors or other odd errors about corrupt files. These are just the file permissions that the program defaulted to, and can be fixed by doing a 'chmod -R 777 /mnt/internal/'. Don't have this problem on sdcard or media because they are just FAT32 formatted, which don't support permissions.
Trying to understand ...
gameman733 said:
I posted this in the nook touch forum by mistake. Please read below and let me know what you think.
Click to expand...
Click to collapse
I don't understand the purpose of the mounts. Why not just create /data/usrdata and put your stuff in there?
I know /data has "access-only/no-read" access for non-system apps, but anything in /data/usrdata/ should be visible (and no need to modify clrbootcount.sh).
If you need "/mnt/internal" (I don't see the need for that either), why not just use a soft link (which is permanent)???
The primary reason for using the mounts was that I was originally planning on trying to mount it in a way that would ignore file permissions, but didn't know at the time that you can't do that with a bind mount. Using a simple link would be just as effective in this case.
However.. / is Read only. Even when remounted read-write, this filesystem is actually regenerated every boot. So nothing in /mnt would stay past the next restart.
The purpose for having it in /mnt (could have been anywhere, I suppose, but it seemed a little more appropriate) was for apps that can't browse /data. For example, gameboid and related programs would get to /data and show nothing, because you can't browse it as a non-rooted app. Having a symlink or bind mount elsewhere in the filesystem where they can browse helps with that. The alternative was to remove the no-browsing permissions from /data. I didn't feel comfortable with doing this, however, as I'm sure there are some security risks to doing this. It probably isn't a big deal, but since we have the tools to do it while maintaining those existing permissions, why not go ahead and do that?
Is there a solution that does not require being rooted?
[I was gonna start a thread about this 1.0 GB vs 16GB issue. Glad someone
beat me to it. ]
A day or two ago, I side-loaded a couple of movies, each about 400-MB in size,
and was surprised to notice that I had only 20% of my 1.0GB remaining.
I haven't 'bitten the bullet', and got brave enough to 'root' my Nook yet.
(Still not sure yet whether my wife will keep it, and it's an XMAS-gift for her.)
But, I'm quite fluent in Linux, so if we DO keep it, I'll definitely get around
to doing the 'root'.
Meanwhile, if anyone does find a way, without rooting, to re-allocate these
built-in assigned storage quotas, please post it in this thread.
Cheers...
gameman733 said:
The primary reason for using the mounts was that I was originally planning on trying to mount it in a way that would ignore file permissions, but didn't know at the time that you can't do that with a bind mount.
Click to expand...
Click to collapse
To solve this issue I've compiled fuse kernel module and bindfs userspace utility. Bindfs is similar to "mount -o bind" but can override permissions and ownerships. I can share how-to instruction and compiled binaries if you want

[Solved] NFS mountpoints and root/superuser privileges

Wanted to update this should anyone run across it - selinux is the issue...
Hi, I would like to know why I can see but not read files in NFS mounts unless they are in the primary storage location(internal storage - /data/media/0) and viewed from an app not running elevated privileges. (problem is if you have the mountpoint at a location you can only access with a file explorer running as root, you can see the files but not read them, and if you aren't root of course you can't get to the mountpoint). You can only read the files when running as a regular user which seems counter-intuitive to my understanding of the basic linux principal of root. This has only started recently, I am guessing android 4.2+
I am able to mount and read off NFS shares with stock kernel on CM10.2 (GS3), but it is a hassle because I have to switch my file explorers from root access to nonroot all the time.
the relevant line for my mounted share example from /etc/exports from server at local ip address 192.168.1.117:
Code:
/home/myth/myth1 192.168.1.0/24(rw,insecure,no_subtree_check,async)
I use smanage app (script manager) (and for some reason script must be run off of /storage/sdcard1 -- external sdcard, not internal memory) and flag it as "su"(root) and "boot"(makes it run at boot).
I have it set up so that I create the folders at boot, then either mount or unmount the network share with 3 different scripts that I can create widgets for on my home screen, but basic language should be same (note change "myth/myth1" to whatever folder names you have, and you only need the primary folder not a secondary, i just set it up this way because I have multiple mounts)
directory creation language:
Code:
mkdir /data/media/0/myth
mkdir /data/media/0/myth/myth1
mount language:
Code:
busybox mount -t nfs 192.168.1.117:/home/myth/myth1 /data/media/0/myth/myth1 -o nolock,rsize=8192,wsize=8192
language to unmount:
Code:
umount /data/media/0/myth/myth1
Now some important things:
1- This server setup (etc/exports) worked fine and had no issues before android 4.2
2- I have had severe issues trying to mount at other points other than /data/media/0, so I can not recommend mounting anywhere else, though it may be possible
3- Starting with Android 4.2, there are major issues seeing things such as NFS mounts among different applications. For some reason I can see, but NOT READ files on the NFS share when the file explore app is running as ROOT/SU. This is why I have only recently been able to get it to work at /data/media/0, and that is because I figured out that the mountpoint has to be accessible by an app when it is not running root privileges. People have hinted that this has something to do with the new multiuser namespaces : see the bottom of this page: http://source.android.com/devices/tech/storage/index.html
any thoughts or understandings would be greatly appreciated on this so I can keep my NFS shares working with further changes

[Q] How to move obb data from internal SD to internal storage?

I have a xperia u, which has not external SD card slot..
Data partition is MUCH bigger than what I need (I'm using 500mb of 2gb) and I want to move obb files to data partition to free some space in SD partition..
Is that possible?
You might try to move the file to the data partition and then create a symlink where the file was originally.
From a shell with root access:
# ln -s /your/data/partition/filename.obb /original/place/filename.obb
I'm doing the same moving apk and dalvik-cache but I have the problem that after reboot files are still there but the app is disabled.
You can check it here: http://forum.xda-developers.com/showthread.php?t=2597924
I would suggest to try it on an app that it's not important for the system and I don't assume any responsability
P.S.
partition where you create symlink must be ext2/3/4
I think I understand how this works.. Lets say symlinks are some kind of 'windows direct access' for files that can be recognized by the system.. Am I right?
How can I figure out what format are my partitions?
I want to move /mnt/sdcard/Android/obb/com.package.name/file.obb to /data/data/com.package.name/file.obb
Assuming that partitions are in the correct format, I'll have to move files with a root file browser, then connect phone with debug on and type this:
-adb shell
-su
-ln -s /data/data/com.package.name/file.obb /mnt/sdcard/Android/obb/com.package.name/file.obb
Is that ok?
Yest that's the use, I don't know about "windows direct access" because I'm linux user
To check how is your partition formatted there are different ways from console but I just tried this app and it works:
https://play.google.com/store/apps/details?id=com.cls.partition
If both partitions are ext2/3/4 remember also to set the same user, group and permissions, you can do that copying the file from shell.
The whole sequence should look like this:
Code:
$ adb shell
$ su
# cp -a /mnt/sdcard/Android/obb/com.package.name/file.obb /data/data/com.package.name/file.obb
# rm /mnt/sdcard/Android/obb/com.package.name/file.obb
# ln -s /data/data/com.package.name/file.obb /mnt/sdcard/Android/obb/com.package.name/file.obb
cp - a to copy preserving permissions and rm to remove the file.
/data is ext4.. /mnt/sdcard is vfat D=
No symlink then
I never used it but you can still mount bind folders (not files) in fat, something similar to symlink:
Code:
$ adb shell
$ su
# mkdir /data/data/com.package.name/obb/
# cp -a /mnt/sdcard/Android/obb/com.package.name/* /data/data/com.package.name/[B]obb/[/B]
# rm -r /mnt/sdcard/Android/obb/com.package.name/*
# mount -o bind /data/data/com.package.name/[B]obb/[/B] /mnt/sdcard/Android/obb/com.package.name/
if it works you need to find a way to excute that on boot maybe with a init script.
And if there is not crucial data you could even bind all the obb folder together like:
Code:
# mount -o bind /data/data/com.package.name/[B]obb/[/B] /mnt/sdcard/Android/obb/
You can also check this thread:
http://forum.xda-developers.com/showthread.php?t=1410262
Double check everything because I never tried it
Is it possible to add init.d support to my current rom and execute a sh file from it to initialize bind on boot?
No idea sorry
You can try asking in your phone section: http://forum.xda-developers.com/xperia-u
I found how to add init.d support!
Not sure if it works for any device/rom/kernel, but it worked for my Xperia U with GingerBeanSS v3.5 (Sony GB based)..
If anyone is interested, go to this link: http://forum.xda-developers.com/showthread.php?p=32716432
Now I suppose I can create a "BindOBB.sh" with the script you mentioned before in any place of /system, and make a "bindobb" file in /system/etc/init.d/ to execute that script..
So theoretically binding folders should work on every boot!
I used windows my entire life.. I'm not completely sure about linux scripts..
Sorry about making so much questions!
I really appreciate your help!
No problem I'm glad if I can help.
Init script is usually named starting with two numbers like: 00script, 20script, 99script that should give the order scripts are excuted.
For the script itself you need to follow the sample you donwloaded so it will be something like this:
Code:
#!/system/bin/sh
#Comment
busybox mount -o bind /data/data/obb/ /mnt/sdcard/Android/obb/
This is to mount all obb folder or, if you want to mount only some, you can write them all in the script or keep a list of packages in another file and make the script read that.
Remember to make a backup and you might try first with only one package
Ok, I've understood everything (thanks google! ) and done it..
mount -o bind[...] isn't executed by init script.. Maybe a syntax error as it is my first time doing it..
The same command (without 'busybox' at first, of course) seems to work via ADB, because in SolidExplorer when I go to obb folder BEFORE running the script it is empy, but after running it all packages' folders and files appear!
Now problem is that when running a game that need obb data, it closes by itselfs (no FC nor 'missing data' warning)..
Same problem with a 3rd party TTS engine that needs obb data too..
The first problem could be that when you try to execute the command partitions are not mounted yet. Check 00 script used to test if init is enabled to mount them.
Another solution could be to use a sleep command to make the script wait some seconds but the first one should do the trick.
For the second problem check permissions. You copied files as root so you need to be sure the apps can access those files as well, in fat system there is no use of users, group and permissions but moving to ext you need to check that.
To be sure you can set obb folder and all files an directories inside as 777 (rwx for all)
Let me know if it's working
Sent from my ZP980 using Tapatalk
NeriL said:
I want to move /mnt/sdcard/Android/obb/ to /data/data/
Click to expand...
Click to collapse
you can easy create a directory bind using luckypatcher with the folder with obb and the folder where you would like to put it
remember to reboot or rescan your sd else it wont work
i use it to play asphalt and fifa
MrCrayon said:
The first problem could be that when you try to execute the command partitions are not mounted yet. Check 00 script used to test if init is enabled to mount them.
Another solution could be to use a sleep command to make the script wait some seconds but the first one should do the trick.
For the second problem check permissions. You copied files as root so you need to be sure the apps can access those files as well, in fat system there is no use of users, group and permissions but moving to ext you need to check that.
To be sure you can set obb folder and all files an directories inside as 777 (rwx for all)
Let me know if it's working
Sent from my ZP980 using Tapatalk
Click to expand...
Click to collapse
I deleted my custom init script and wrote following command at the last line of '00test' script:
busybox mount -o bind /data/obb/ /mnt/sdcard/Android/obb/
Mount then worked fine
(By the way, my custom script was named '99bindobb', so it was supposedly executed after everything else)
Also checked permissions: /data/obb/ and com.package.name folders inside it were rwxrwxrwx, but files inside were rw-------!
Changed permission of files to rwxrwxrwx..
Now everything works flawlessly at each boot!
Thank you so much! =D =D
You saved about 500Mb of my 4Gb!
And also I learned a lot about linux scripts, busybox and file system permissions!
You are welcome
For the 99 script that only define the order between the user init scripts so it still depends when they are called during boot.
Enjoy the power of Linux
Sent from my ZP980 using Tapatalk
Hi MrCrayon..! I'm here again
I changed rom and did the same as before to use /data insted of /mnt/sdcard for apps files..
This is exactly what I did:
I copied the script I used to sd (my edited 00test), changed rom (switched from Sony based GB rom to Sony Stock ICS rom), added init.d support (/data/Test.log indicates that it works), copied script to /system/etc/init.d/, changed script permissions to 777, created folders /data/AndroidData/ and /data/obb/ with 777 permissions and moved files from sd folders to custom folders in /data..
Finally updated busybox just in case
Script doesn't work, but executing 'mount -o bind' commands from ADB does! How can I fix that?
This is my init script:
#!/system/bin/sh
#Init.d Test
if [ -e /data/Test.log ]; then
rm /data/Test.log
fi
echo Ryuinferno @ XDA 2013 > /data/Test.log
echo Init.d is working !!! >> /data/Test.log
busybox mount -o bind /data/obb/ /mnt/sdcard/Android/obb/
busybox mount -o bind /data/AndroidData/ /mnt/sdcard/Android/data/
busybox set_perm_recursive(0, 0, 0777, 0777, /data/AndroidData, /data/obb)

[Q] Mounting CIFS - Empty Directories

Hi all,
So I've spent hours trying to solve this, using everything I have found on the Internet. (This problem isn't exclusive to CIFS mounts by the way, it's all FS types. CIFS mount is what I require)
Basically I have an android box that's running 4.4.2. I need to mount a NAS box onto the file system. I can do this no problem using Terminal as SU. As soon as I use another App to navigate to the location, the mounted location isn't visible. I know that it is a known bug/security restriction after 4.2, and is due to multiusers or something. People have suggested including the mount command into /system/bin/debuggerd because the start command is a system command that has higher privileges or something. Anyway, I've tried this by just removing the contents of debuggerd and typing the following:
#!/bin/sh
mount -o username=JOELB,password=password -t cifs //192.168.1.252/PUBLIC /data/media/0/NAS
However, this doesn't work on boot, or if i run 'start debuggerd'
Apparently /data/media/0 is the location I should be mounting to, due to the bug/security flaw. Apps like mount manager are useless because they only work for that app.
Can anyone help me on this... It's killing me!!
Many thanks
Joel

Categories

Resources