[App/Script] Mounts2SD - An All-in-one sd-ext solution (2.2.0/5.5.0 - Jan 26, 2013)
Mounts2SD - An All-in-one to sd-ext script
Mounts2SD is a customizable sd-ext control script that can be used to move content to and from the second sdcard partition known in Android as sd-ext. These scripts comes in many variants with different purposes. Mounts2SD has most of these, and more, build into one single script with and control App used to configure the script options and monitor the current state of each setting.
In addition Mounts2SD is also the only script that has a bunch of safe guards build-in for almost any situation, making sure that when things go wrong, the script will adapt and try keeping your phone running 100% and try to make sure that data is not lost or corrupted.
Init.d
The sd-ext scripts like Mounts2SD works better when not interfering with the system processes, which are started during boot. Good init.d implementations will execute all init.d scripts before attempting to start these services, however many do not. Some init.d implementations starts init.d along with the system processes at the same time, while others starts init.d after all system processes.
In order to fix this issue, head over to the Injector Thread
Script Features
SWAP Support
Place Apps in /data and use them as System Apps
Move Apps to sd-ext
Move Dalvik-cache to sd-ext
Move Apps Data to sd-ext
Move Cache /data, /sd-ext or tmpfs
Able to revert any prev. options
Internal nand and sdcard optimization
Handles slow sdcards that takes time to initiate
Checks/Fixes the sd-ext partition during boot (Needs e2fsck)
Disable/Enable Ext4/Ext3 Journal
Let's you use whatever linux filesystem supported by kernel
Revert the sd-ext & data mount points to use sd-ext as /data
Android Market 'Not enough space' fix
Checks available free space and folder sizes before moving content
Bunch of other safe-guards to avoid issues
Application Features
Automatic recovery script installation for whenever direct installation fails (For an example due to S-On Nand Secority)
Busybox Configuration option (With recovery fall-back for S-On devices)
Log Viewer (With Save-to-sdcard option)
Status Overview to monitor current configuration states
Configuration Overview from where you can configure any part of the scripts boot settings
Notifies you on boot whenever an issue was detected
How to install
Using the Application
Download/Copy APK file to the sdcard
Open a file manager on your phone and select the APK from the sdcard
-------------------------------------------------
Using Recovery ZIP
Download the ZIP that matches your device, to the sdcard
Reboot into recovery
Select "Install from sdcard"
Choose the ZIP you downloaded, installation will start
Reboot the device back into Android
Partition table
Required partition table
/sdcard (Fat32)
/sd-ext
SWAP (Optional)
Safe Mode
As of Script Version 2.2.0, m2sd has a safe-mode state. This is an automatic state that is used when the script detects that Service Manager has been launched, which is the affect of your init.d implementation which is using a service rather than a direct execution from within init.rc
When Service Manager is running, it means that services like dexopt and package manager is running as well. The problem with this is that these services will built the dalvik-cache, scan for packages, application data, libraries etc. If we are in the process of moving these things around at the same time, you will end up corrupting the system and will most likely experience boot loops, app crashes and so on. Therefore m2sd will auto-disable options like Dalvik, data and R-Mount, only allowing Applications to be moved no mater what options you have enabled.
As of Script Version 5.5.0 (App version 2.2.0), m2sd has an experimental workaround for devices that is executing init.d from within a service. This workaround will allow you to use the Data and Dalvik option if Safe-mode has been disabled. The workaround however is built using a ugly and possibly unstable hack, so you are advised to make a backup of your /data partition before trying this out, as the success of this workaround might depend on your Device and/or ROM.
Register apps on /data as system apps
Mounts2SD provides an additional app directory (/data/app-system). Every app placed in this directory will be automatically linked to the /system/app folder, making android believe that it is a system app. Some apps needs this in order to provide additional options. By using /data/app-system, you can achieve this from any file manager without giving write access to the system partition and without taking up two much space on that partition.
Links will be automatically removed again once an app is removed from /data/app-system
Script Configuration Properties
All script configurations are saved in /data/property/m2sd.<config name>. Below is a list of all properties, their function and possible value.
=========================
m2sd.move_apps('0' = false or '1' = true)
Enable/Disable the option to move all APK files from /data to /sd-ext
-------------------------------------------------
m2sd.move_data('0' = false or '1' = true)
Enable/Disable the option to move application data from /data to /sd-ext
-------------------------------------------------
m2sd.move_dalvik('0' = false or '1' = true)
Enable/Disable the option to move dalvik-cache from /data to /sd-ext
-------------------------------------------------
m2sd.enable_reversed_mount('0' = false or '1' = true)
Enable/Disable the reversed mount option which will mount sd-ext as /data as data as /sd-ext
-------------------------------------------------
m2sd.enable_cache('0' = false, '1' = true or '2' = auto)
Enable/Disable the cache option. This option will move your cache to the partition with most available space, or to a tmpfs if both /data and /sd-ext has low space available. You can set this to auto, which will only move the cache if the internal is below 40mb.
-------------------------------------------------
m2sd.no_tmpfs_cache('0' = false or '1' = true)
Disable the tmpfs cache. This will force the above option to only use /data or /sd-ext as cache replacement, never an tmpfs
-------------------------------------------------
m2sd.enable_swap('0' = false or '1' = true)
Enable/Disable the SWAP partition. This will of cause only work if you have a third partition on your sdcard formatted as SWAP
-------------------------------------------------
m2sd.enable_sdext_journal('0' = false, '1' = true or '2' = auto)
Enable/Disable ext(3/4) journal. You can set this to auto if you want to use the partition default. This means that the script will not touch it. If you set it to disable, the script will disable the journal and of you set it to enable, the script will enable it.
-------------------------------------------------
m2sd.enable_debug('0' = false or '1' = true)
Enable/Disable the script debug log. If this is enabled, the script will generate a more extended log file which can be used to track down any issues you might have
-------------------------------------------------
m2sd.set_sdext_fstype('<fstype>')
Set the sd-ext partition to be mounted using a specific file system type rather than auto detecting it. This is useful as android's linux backend is not great at auto detecting and you could end up mounting your ext4 as ext2
-------------------------------------------------
m2sd.set_sdcard_readahead('<readahead in KB>')
Set your desired readahead value for the sdcard. Just note that this will affect the whole sdcard and not just one specific partition
-------------------------------------------------
m2sd.run_sdext_fschk('0' = false or '1' = true)
Run a file system check during boot and fix any issues there might be
-------------------------------------------------
m2sd.disable_safemode('0' = false or '1' = true)
Enable/Disable safe-mode. This will allow more options to be used on devices where it has been disabled. Just note that using these options on such devices could leave you with boot problems or multiple FC's of apps
-------------------------------------------------
m2sd.disable_cache_folders('0' = false or '1' = true)
Do not touch the Download manager and Package manager caches. These are changed to fix market install issues, but could provide problems for some people which is why the disable option exists.
This will provide you with the standard legacy text installer.
Change Log
Code:
2.2.0 (5.5.0)
-----
Script
* Added experimental full support for service versions of init.d (Safe-mode needs to be disabled in app)
* Fixed optimizing wrong data partition when R-Mount is enabled
Application
* Encreased configuration loading speed by 90% or more
2.1.0 (5.4.0)
-----
Script
* Added support for Android 4.2's idiotic slave mounts space
Application
* Added French Translation by XDA Member @PerfectSlayer
* Updated RootFW to add more FC fixes
2.0.1 (5.3.1)
-----
Script
* Fixed small mounting issue
Application
* Updated RootFW to fix some crash issues
* Fixed app related crash issues
2.0.0 (5.3.0)
-----
Script
* Added translation functionallity
* Fixed 'Arguments to big' busybox error
Application
* Introducing SpazeDog RootFW Framework (Replaces the old internal Root Class)
* Finished the translation functionallity
* Added Danish Translation
* Fixed some false warnings
_____________________
1.2.0 (5.2.0)
-----
Script
* Fixed invalid warnings
* Fixed issue with HTC Desire on Android 4.2 (And properly more devices)
* Added swappiness action for the new app option
* Some other minor changes
Application
* Added more Readahead values
* Added more File system types
* Added new option to set swappiness
_____________________
4.6.2
-----
* Rewrote some more things to make it compatible with older/limited busybox versions
* Added relatime when disabling atime. It still reduces a lot of writing while keeping atime updated
* Added a better way of detecting service executed init.d implementations (safe-mode)
* Added check to make sure that Mounts2SD is only executed once (Have been problems when dupplicate sysinit entries has been added to init.rc and init.local.rc)
* Allowed the cache option to fully work in safe-mode (does not seam to course problems)
dalvik-cache remains, so does all of the app related data. Only the APK's is moved.
Quote:
Originally Posted by Taki2011
Hi I cant understand How to use it ! any guide ?!
First of all you need a custom rom. If you have a stock rom it will not work since you need a rom that will allow custom scripts during boot.
You will also need to know how to use ADB (An android tool for communicating with your phone. It is used to enter the android shell and also to transfer files to and from the phone, among other things).
And last, you will need at least 2 or 3 partitions on your sdcard (Otherwise it's a waste of time, although the script is build to adapt for these scenarios). One as a regular fat32 sdcard partition, one for the sd-ext and one for the cache. (Use ext2 for the last two. ext3 will eat your card to fast)
Here is the steps (You need to have ADB working on your computer).
Copy/Paste the script content into a file editor and safe the file with the name "99mounts2sd"
Plug your phone to your computer using a usb cable (Select charge only on your phone))
Open a terminal on your computer (In windows use "run" and type "cmd")
Type in shell: "adb shell mount -o remount,rw /system"
Type in shell: "adb push <path to script> /system/etc/init.d/"
Type in shell: "adb shell chmod a+x /system/etc/init.d/99mounts2sd"
Reboot your phone
The first time you boot your phone using the script it will take some time, because the script needs to copy all of your APK's from internal storage to the sd-ext partition.
It didn't work for me, I made the files made sure they were in the right place and rebooted but booted normally. No delay on first boot and still seems to not be using the other two partitions on my sd card. i used cwm4 to partiton my SD card and it is partitioned correctly (3 partitons). I see the script says "log" I don't know where the log is stored or how to view it. Thanks.
Was I helpful in solving your problem please DONATE
Anything at all would be appreciated greatly.
It seams that logcat has a very limited lifetime. In order to get the log info, you would have to get it during boot.
Instead I have updated the script to do this itself. Update your script and config file content with the new above code.
In the config file set VAR_DEBUG="yes" and reboot your phone. Now enter a terminal and type "cat /var/mounts2sd.log | grep mounts2sd" which will show you all the messages from the script, and possible errors, if any.
XDA Developer TV Producer Kevin set up his phone to respond to … more
XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality. Are you a developer?