[Q] Remounting storage with -o exec - Android Software/Hacking General [Developers Only]

I've been playing with ways of moving data from /data/data to SD that do not involve any partitioning of SD, as an idea for a new feature for my Force2SD app. Specifically, I'd like to be able to move the lib directories for various apps, as some of the libs take up a ton of space. (Moving the other directories might potentially cause ownership problems, especially when moving data back, but the lib directory has owner 1000, which is the same as /storage on my Archos 43.)
Anyway, I was surprised that in a root shell
Code:
mount -o exec,remount /mnt/storage
works just fine. Moreover, it also works fine when I call up the root shell from a MEDIA_INSERTED broadcast receiver, which is even better.
I do have two questions:
1. Is there any reason I'm now aware of not to move /data/data/app.name/lib to /sdcard for apps that have already been moved to /sdcard by Froyo (and up)? Once one remounts /mnt/storage, a simple symbolic link seems to be enough--I tried it with Google Earth. I suppose there are security issues. How much should I worry about that?
2. Is there an easy way to find out where the official external storage -- the external storage pointed to with getExternalStorageDirectory() -- is mounted? Is it, perhaps, always mounted on /mnt/storage, or do different devices have different mount points? The best way I can think of is executing df dirname, where dirname is whatever getExternalStorageDirectory() returns, but that's slightly slow, and I don't want to slow things down in the MEDIA_INSERTED receiver.

I'm continuing experimenting. I made a tiny app that remounts media with the exec option whenever media is mounted. Then I moved the /data/data/*/lib directories for Google Maps, Google Earth, Reckless Racing Lite, Adobe Air and Netflix to a /storage directory, saving about 50mb. I had some crashes in Reckless Racing, but I think they had something to do with a problem with the ad server, not with the lib, and now it works fine. The other apps seem to work just fine, too.
The apps themselves were already moved to external storage (with Force2SD in the case of some of them), so there isn't going to be any issue of the app needing the lib before external storage is mounted.
Of course, it's going to be a nuisance when the app updates. I am guessing it'll update just fine, but leave me with an orphaned lib directory.

OK, here's a problem, which may or may not be related to this: every so often, the device slows to a crawl, and logcat shows continual index errors on one of the mmcblk devices (alas, I didn't note which one). For the next experiment, I'm moving the libs from the internal drive to an external SD card.

Related

[REQUEST] Move App-Data to/back from /data to /sd-ext

Are there any plans to implement a Button into the App-Manager, to move the Data-Part of an app to the /ext2 Partition ?
Especially on low memory devices (like the G1) this will give us the chance to install a lot of apps without runnung to "low space on device".
I have written a very small bash-script to manually do this job, but it would be more comfortable with a Button.
move.sh
Code:
#!/system/bin/sh
#
#data_to_move=com.alk.copilot
#data_to_move=com.camelgames.blowup
#data_to_move=com.drodin.tuxrider
#data_to_move=com.gameloft.android.AMEU.GloftAsphalt5.asphalt5
#data_to_move=com.navigon.navigator
#data_to_move=com.polarbit.ironsightlite
#data_to_move=com.polarbit.ragingthunder
#data_to_move=com.polarbit.rthunder2
#data_to_move=com.polarbit.waveblazerlite
#data_to_move=com.estrongs.android.pop
su
mount -o remount,rw /data
mkdir /sd-ext/data
cd /data/data
echo About to Move ${data_to_move}
cp -r -p ${data_to_move} /sd-ext/data
rm -r -f ${data_to_move}
ln -s /sd-ext/data/${data_to_move} ${data_to_move}
unmove.sh
Code:
#!/system/bin/sh
#
#data_to_move=com.alk.copilot
#data_to_move=com.camelgames.blowup
#data_to_move=com.drodin.tuxrider
#data_to_move=com.gameloft.android.AMEU.GloftAsphalt5.asphalt5
#data_to_move=com.navigon.navigator
#data_to_move=com.polarbit.ironsightlite
#data_to_move=com.polarbit.ragingthunder
#data_to_move=com.polarbit.rthunder2
#data_to_move=com.polarbit.waveblazerlite
#data_to_move=com.estrongs.android.pop
su
mount -o remount,rw /data
mkdir /sd-ext/data
cd /data/data
echo About to unMove ${data_to_move}
rm ${data_to_move}
mkdir ${data_to_move}
cp -r -p /sd-ext/data/${data_to_move} ${data_to_move}
Apps that need lots of space should use the fat32 partition gracefully, using this hack would considerably slow down your system(even class6). Why double the reads and writes to the slow mmc?
Because not all apps using the fat32-Partition.
Navigon for example uses 14 MB of internal storage.
If you install such apps on a G1, you can quickly run out of space.
Low on cache space will considerably slow down the overall system performance.
I would not suggest to move the data of any installed apps, but from the big ones.
Apps like Navigation and 3D-Games are writing not frequently their data and if you own a G1 you are already swapping when using an Eclaid based ROM. So this wouldn't make a big difference in the livetime of your sdcard.
Perhaps someone could implement a partial move (e.g. only libraries) to avoid massive writes to the card ... and/or setting a threshold value, so apps with small data could not be moved.
For me, moving the apps in the Script above has given me additional 35 MB internal space and everything is still runnung "fast".
/data/data
TheGenesis said:
Because not all apps using the fat32-Partition.
Navigon for example uses 14 MB of internal storage.
If you install such apps on a G1, you can quickly run out of space.
Low on cache space will considerably slow down the overall system performance.
I would not suggest to move the data of any installed apps, but from the big ones.
Apps like Navigation and 3D-Games are writing not frequently their data and if you own a G1 you are already swapping when using an Eclaid based ROM. So this wouldn't make a big difference in the livetime of your sdcard.
Perhaps someone could implement a partial move (e.g. only libraries) to avoid massive writes to the card ... and/or setting a threshold value, so apps with small data could not be moved.
For me, moving the apps in the Script above has given me additional 35 MB internal space and everything is still runnung "fast".
Click to expand...
Click to collapse
there is already a script in existance to move things like that:
# lucid -d -sd
would move app data to the sdcard and symlink .. this (however) does not move individual pieces .. i would be interested to know the speed difference on these apps that you moved .. also .. this will create extra difficulty when attempting any nandroid backup/restore .. i have seen people putting up comments because their phone crashed due to the excessive number of symlinks across the phone .. if you are not careful with them you could lose all your data
The Space allocated by the "big apps" is mainly used by their ./lib dir. Because of this, it would be enough to move and symlink only those dirs.
With Games the "rest" goes to settings and scores.
On a G1 there is absolutely no difference in speed when moving data to sd.
Perhaps its because the G1 is not the top performer at all
I have played those games in the list with data in internal and on sd-ext and there is no difference in speed ... loading time is also the same.
I'm satisfied with the results, but these scripts didn't remove the data when apps where uninstalled or re-installed and thats the reason of my request.
Take a look on your storage and see how much space (libraries) should be on the sdcard.
Code:
du -sk /data/data/* | sort -rn | head
btw ... did you ever enabled JIT on a G1 and played ExZeus or Armageddon Squadron ?
Its amazing what is possible on this "outdated" Hardware!
P.S. Nandroid Backup runs perfectly with this symlinks (no recursive/double Backups)
Update:
Nandroid Backup only saves app and app-private ... could you edit this to save everything excluding "crap-dirs" ?
If nandbackup uses standard tar calls, you can use the following command:
Code:
tar pcvf /sdcard/nandroid/sd-ext.tar . -C /sd-ext --exclude dalvik-cache --exclude lost+found
... it would save everything the user place on the partition including userinit.sh
Restoring such a tarball works perfectly with nandbackup.
Thx in advance
Thom
Int. mem for SWAP ?
well, after the moving some heavy apps data
I have 54mb free Int. mem (out of 90)
is that possible to use 24-32mb of this (fast?)memory
for SWAP ? instead of linux swap
and does it make any sense?
...just tried to enable /swapfile.swp via Swapper2
though it says
-creating swap - ok
-changing permission - ok
-formatting swap - ok
but
- enabling swap(file) - FAIL
sorry if it's just another stupid question
G1, stock cm5.0.8 test4, 32mb linux swap
TheGenesis said:
Update:
Nandroid Backup only saves app and app-private ... could you edit this to save everything excluding "crap-dirs" ?
If nandbackup uses standard tar calls, you can use the following command:
Code:
tar pcvf /sdcard/nandroid/sd-ext.tar . -C /sd-ext --exclude dalvik-cache --exclude lost+found
... it would save everything the user place on the partition including userinit.sh
Restoring such a tarball works perfectly with nandbackup.
Thx in advance
Thom
Click to expand...
Click to collapse
Have you tried BART? http://forum.xda-developers.com/showthread.php?t=562292
It's included in the recovery, and lets you backup/not_backup whatever you want.
zelipukin said:
well, after the moving some heavy apps data
I have 54mb free Int. mem (out of 90)
is that possible to use 24-32mb of this (fast?)memory
for SWAP ? instead of linux swap
and does it make any sense?
...just tried to enable /swapfile.swp via Swapper2
though it says
-creating swap - ok
-changing permission - ok
-formatting swap - ok
but
- enabling swap(file) - FAIL
sorry if it's just another stupid question
G1, stock cm5.0.8 test4, 32mb linux swap
Click to expand...
Click to collapse
It's not a stupid question ... I have had the same Idea yesterday ...
I have googled about life spawn of the internal flash memory, but I haven't found any satisfactory answer yet.
Anywhere here who know how fast the internal flash is ?
What about write cycles and wear levelling ?
If it has no integrated wear levelling, swapping will kill the phone in a few days.
I think your enable swap has failed due to wrong permissions ... try to enable with a defered call in your userinit.
Update: I have checked my filesystem ... /cache has actually 29 MB free ... is it correct, that /cache is only used by OTA updates ? Probably we can create a priorized swap there in addition to ext.
Keep up the good work dude...this sounds great
TheGenesis said:
Navigon for example uses 14 MB of internal storage.
If you install such apps on a G1, you can quickly run out of space.
Low on cache space will considerably slow down the overall system performance.
I would not suggest to move the data of any installed apps, but from the big ones.
Apps like Navigation and 3D-Games are writing not frequently their data and if you own a G1 you are already swapping when using an Eclaid based ROM. So this wouldn't make a big difference in the livetime of your sdcard.
Perhaps someone could implement a partial move (e.g. only libraries) to avoid massive writes to the card ... and/or setting a threshold value, so apps with small data could not be moved.
For me, moving the apps in the Script above has given me additional 35 MB internal space and everything is still runnung "fast".
Click to expand...
Click to collapse
If navigon is using that much internal storage it's a very poorly written application. Low cache doesn't slow the system down, just apps that require such huge amounts of it.
I'm already swapping when using Eclair? Wrong, using swap on the sdcard is horrible, I'd never recommend it to anyone and I personally don't use it. I have 114 apps installed and my cache is 9% used, it seems to me like your apps aren't clearing their cache correctly, or they're just poorly written. The argument that 'you are already swapping so this wouldn't make a big difference in the livetime of your sdcard' is untrue, you are effectively doubling the amount of read/writes to the mmc, if not more, so the lifetime could potentially be cut in half, of course depending on use.
I'd say nice try, but this really just working around crap apps.
I use a 16 GB class 6 SD-Card with static wear-levelling.
Assuming that a standard-flash-nand-cell lasts about 10.000 write cycles, and my swap-write-turnover is currently about 1,6 GB per day, my SD-Card will last about 273 years (minus regular writes).
So I don't care about livetime.
Besides Navigon, there are many apps, that store their huge libraries to /data .... Games in most cases ... If you aren't using "bad written apps" its fine for YOU ... everyone else has to do some tweaks when installing some of them to the limited internal storage.
I have 278 apps installed and the only limit for me, is currently the free space on my sdcard.
If you haven't enabled swap since you have flashed your first Eclair ROM, you have probably never felt what is "speed" or you never need more than 1 app running simultaniously .... or you are using a different phone instead of a G1
You say "swapping to sd is horrible" ... I think you have used the wrong parameters ... when I diable swapping my system is lagging ... even when I work with one app the same time.
Did you enabled compcache while swapping ? Did you use a swapfile on FAT32 ? Is your swappinness levor 50 or above 60 ? Are you using al class 4 or slower sd-card ? Are you running heavy memory consuming apps without killing them from time to time ?
All these can turn a fast swapping system into an unusable phone.
You cannot enable swap and use the system like before.
Update:
I have copied 18 MB from cache to data and it tooks round about 18 seconds.
Same file from sdcard (FAT32) to sdcard tooks 6 seconds ...
I will use the sdcard
I should have listened to internal voice telling me not to argue with a fool cause people might not know the difference..
Something strange
I did some stupid (owing to absence of linux knowledge)
experiments regarding to swap_2_/
I believe if it possible it should be done through userinit/config
or smth during boot to enable r/w. give necc permissions etc.
I just used Swapper and RootManager
If I create .swp (it creates but does not work) in any place but /cache
it (just existence of this file) does system unstable, slow and unresponsive
in /cache or any existing or newly created folders inside /cache/ it's OK
before reboot when those new folders/files disappear
=
After a wile something happened with my phone (not a first or last time)
many apps caused FC, settings were lost etc
tried "fix uid missmatches" - dots filled out numerous screens
and after ~20min I decided to reboot
tried nandroid - same endless ....................................................
after the reboot I found no FCs but still missing settings for some apps
(sim_linked_data apps like CoPilot were OK) so I Titaniumed non-working apps
data (5-6 apps) and evrthng seems fine
=
BUT when I look at internal memory available
I find 73Mb (out of ~90) FREE
there was 53Mb free before the accident
Is that normal? And whats the limit?
I have my laps and brain scratched to find some application of this
=
just my experience
-compcache always gives me horrible slow phone - not using
-linux swap - best results compare to no_swap - allways use
Some apps are storing many data to /data and sometimes to /cache.
I think your restores have cleared some of them.
Try CacheMate instead of such manouvers
I have checked the write throughput using dd:
Internal Storage: 3,5 MB/s
Class 6 SD Card: 7 MB/s
... annoying ... USB to SD-Card is 3,5 MB/s and SD-Card via Card-Reader (PC) is about 9 MB/s.
Hey man, i had the same problem and decided to go a head and write a small tool that does exactly this, this is a UI tool that shows all the folders in /data/data (excluding system folders) and let you move your apps to your sd, you should have an APP2SD ROM installed with root (of-course) and sd card partitioned to EXT and FAT32.
Contact me if you want to check it out, i never found the time to publish it ([email protected])
hi,
I have tried that and it works, but...it works until reboot...
After reboot I don't see directory /sd-ext/data....
I don't know why it always been deleted....

[Q] Directory Bind on LG P990 not remembering binds

Note: Feel free to move this thread to the relevant section, this site is a labyrinth and I couldn't find anything P990-related.
Right, basically my phone is rooted, but whenever I bind a directory in Directory Bind it forgets it as soon as I restart. I have checked the "bind on boot", I've selected each bind so that the save icon is green, it has SU permissions, Directory Bind has as much permission on my phone as I do, but every entry resets at boot.
Is it a conflict between Directory Bind and P990's, is it that DB doesn't work on P990's or is there an extra step that must be taken?
The P990 has 6Gb of memory, 1.5 for system and 4.5 for internal SD, it fills up pretty quick and I want to redirect some of my bigger apps and games at the 16Gb external SD.
The binds work because I've relocated about a gig and a half to the external using 3 binds and the apps work perfectly, but as I said rebooting wipes the binds and the apps no longer find their data.
I can also verify that the phone is rooted because I've used it to change system fonts, update BusyBox and in Terminal emulator I can use SU commands.
Sorry if this much info is overkill, but I reckon the more info the more likely someone can help.

[Q] Question about directory bind, foldermount and the like

Ok, so off and on I have been doing some looking around on how to move things from teh internal storage to the external.
Then I had a question.
I know that these programs create an "image" i guess of the stuff that is supposed to be on the internal making the system think its still there. With the mount and this "image" taking up "space" - are you ever able to actually make the device think you have freed up space and install more things?? Does it really actually make any sense to do any of these things?
I played around with a few in directory bind, and while my external availability number changed, my internals didnt. i checked both with the binds active and disabled. the numbers were exactly the same.
At first i was thinking that maybe you would have to temporarily unbind one thing (to remove the image from the internal) and install the new thing, create a new bind for the new thing, and then renable both the old and new things.... but with the internal numbers not changing even with binds off (stuff only on external) this doesnt make sense either.
has anyone run into this and found a solution??

Insufficient storage available - HTC one S

Hi everyone,
When I try to install new apps or try to update an existing app, I'll receive the error message that I don't have enough storage on my device. In my storage settings I can clearly see, that I have more than 250MB left (of 2,34GB). At the moment I can't even install something that is below 1 MB.
For a long time I was running standard Android 4.1 on this HTC one S and lived with this error... Last week I tried to get to the cause of that issue, because it annoys me every day a little more. I rooted my device and flashed Cyanogenmod 12.1, hoping that this could fix my issue. But it didn't. After installing some apps I'm again facing that annoying issue.
In my storage options I do have the possibility to move apps to "SD". Even though the HTC one S doesn't have an SD slot, I guess this is moving the apps to another partition of the flash. Unfortunately they are not copied completely to the other partition. In some cases only a few MB or sometimes only a few KB are moved to that "SD", according to my storage settings.
I already wiped my cache, but unfortunately that didn' t change anything. Is someone of you running into the same issues or even has a solution for me? If you need more informations or tests, just let me know.
Thank you guys in advance!
I have the same problem and it is just absolutely out of control. I can't understand why this garbage is allowed to happen. I have very few apps, with the biggest being GApps' updated versions. But the phone's storage only seems to be 2GB - which is unusable.
It seems like modern phones use a "dynamic /data" arrangement, where /sdcard is really a virtual path to /data/media (so the sdcard contents actually exist in the /data partition, hence can't be mounted as USB storage or FAT). I'm constantly running into the "insufficient storage" problem with >200MB free - which is hardly enough to even work with anyway.
The problem is made significantly worse by dalvik-cache storing a second copy of the app - so that instead of a 20MB app only taking 20 MB of storage, it really takes about 40MB (or more, depending on extra uncompressed data). Like keeping a copy of the installer along side the actual program, for every program you use on your computer.
I have no need for any "/sdcard" storage, as almost all my data is cloud-based (Dropbox photos, Tidal, Slacker, Spotify music, etc), so I hope to find some way to repartition the internal storage to split it up into 8GB /data with the rest as /sdcard (possibly as low as 4GB), and minimize the /cache partition which is generally unused anyway. It's a damn shame that this isn't given more priority among the people trying to squeeze more /sdcard space (to use with what apps?!). :/

FolderMount or other means to mount external SD dirs on internal /sdcard

There seems to be quite a bit of discussion about this but no real resolution. I've been trying to find a way to mount directories on my external SD card onto the internal /sdcard directories to force apps that only can write to /sdcard internally to actually write to the external card. What a mess. I've tried symbolic links, battled the FUSE mounts, experimented with "mount -o bind" -- on and on. FolderMount claims to do such things, but bricks the phone.
I can do the bind mounts -- and when I look at them with adb they appear to be correct. But the apps continue to write to the internal /sdcard dirs. I've also turned off SuperSu mount namespace separation in testing.
It's a shame that something that really should be so simple is such a PITA. Any new ideas? Thanks!
Why don't you use ADB and partition your SD card as internal storage. Samsung took out the adoptable storage feature for Marshmallow. For the workaround go here:
http://forum.xda-developers.com/galaxy-s7/how-to/enable-adoptable-storage-s7-t3333511
I considered that early on. The problem is that I've never seen a reasonable explanation of how "bonded" memory like that is handled. Right now I have a 64GB card split as one exFAT and one ext2 partition (the latter for link2sd, and mostly empty). But at least this lets me have some control over where apps end up. But if I bond ("adaptable") an SD card partition to the internal memory, I (AFAIK) lose that control. Any given app and app's data could end up on faster internal memory or slower external memory, and I wouldn't be able to control it. Also, at this point wiping the phone to do this would be a serious PITA. Am I missing something? Thanks!
Actually, you can partition part of the SD card as internal and part of it can remain external using the ADB method. I have a 64GB card myself, and it works great. I would recommend a high speed one though.

Categories

Resources