New: XDA launches forum for app developers. Discuss coding, tools, marketing, and more.
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
dk_zero-cool
Old
(Last edited by dk_zero-cool; 3rd May 2013 at 06:44 PM.)
#1  
dk_zero-cool's Avatar
Recognized Contributor - OP
Thanks Meter 3465
Posts: 2,385
Join Date: Nov 2010
Location: Horsens
Default [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
    1. Download/Copy APK file to the sdcard
    2. Open a file manager on your phone and select the APK from the sdcard
    -------------------------------------------------
  • Using Recovery ZIP
    1. Download the ZIP that matches your device, to the sdcard
    2. Reboot into recovery
    3. Select "Install from sdcard"
    4. Choose the ZIP you downloaded, installation will start
    5. Reboot the device back into Android

Partition table
  • Required partition table
    1. /sdcard (Fat32)
    2. /sd-ext
    3. 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.

Supported Languages

Downloads
  • Github (Source)
    Build the application yourself
    ===========================
  • Play Store
    Install directly from Play Store
    ===========================
  • 2.2.0 (5.5.0) APK (Jan 26, 2013) (MD5: dd54ace01d9b17c72081a06cd1d072c7)
    1. [Default Mirror] SourceForge.net
    2. [Default Mirror] MediaFire.com

    This is the Application which can be installed directly on the phone
    -------------------------------------------------
  • 2.2.0 (5.5.0) Ext4 ZIP (Jan 26, 2013) (MD5: 80c218ff53009c8a0ccde1927361def2)
    1. [Default Mirror] SourceForge.net
    2. [Default Mirror] MediaFire.com

    This will provide you with an recovery ZIP for newer Ext4 devices
    Does not have the file /proc/mtd
    -------------------------------------------------
  • 2.2.0 (5.5.0) MTD ZIP (Jan 26, 2013) (MD5: 4762d7d85c9cd934f97ba3ba36294fdd)
    1. [Default Mirror] SourceForge.net
    2. [Default Mirror] MediaFire.com

    This will provide you with an recovery ZIP for older MTD devices
    Will have the file /proc/mtd

Old Downloads
  • 1.2.0 (5.2.0) APK (Jan 10, 2013) (MD5: a8c94d06562f6b6c0b46095e4e332781)
    1. [Default Mirror] SourceForge.net
    2. [Default Mirror] MediaFire.com

    This is the Application which can be installed directly on the phone
    -------------------------------------------------
  • 1.2.0 (5.2.0) Ext4 ZIP (Jan 10, 2013) (MD5: bc99d2b25e1c2c292910efb1345e1a50)
    1. [Default Mirror] SourceForge.net
    2. [Default Mirror] MediaFire.com

    This will provide you with an recovery ZIP for newer Ext4 devices
    Does not have the file /proc/mtd
    -------------------------------------------------
  • 1.2.0 (5.2.0) MTD ZIP (Jan 10, 2013) (MD5: 907def027ab3b62c764f0618befc6a44)
    1. [Default Mirror] SourceForge.net
    2. [Default Mirror] MediaFire.com

    This will provide you with an recovery ZIP for older MTD devices
    Will have the file /proc/mtd

Older Downloads (No App)
  • 4.6.2 Aroma Installer (Jul 14, 2012) (MD5: 602622bc20d212c87ac2f0ba8bf0d45f)
    1. [Default Mirror] SourceForge.net
    2. [Default Mirror] MediaFire.com

    This will provide you with the graphical installer Aroma.
    -------------------------------------------------
  • 4.6.2 Legacy Installer (Jul 14, 2012) (MD5: 8a523c392c9290490a4e3140244d16bc)
    1. [Default Mirror] SourceForge.net
    2. [Default Mirror] MediaFire.com

    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)
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2012-12-15-08-36-45.jpg
Views:	10977
Size:	26.2 KB
ID:	1574684   Click image for larger version

Name:	Screenshot_2012-12-15-08-37-03.jpg
Views:	9481
Size:	22.8 KB
ID:	1574685   Click image for larger version

Name:	Screenshot_2012-12-15-08-37-18.jpg
Views:	9034
Size:	33.4 KB
ID:	1574686   Click image for larger version

Name:	Screenshot_2012-12-15-08-37-29.jpg
Views:	8440
Size:	13.6 KB
ID:	1574687  
The Following 235 Users Say Thank You to dk_zero-cool For This Useful Post: [ Click to Expand ]
 
denzel09
Old
(Last edited by denzel09; 12th November 2011 at 11:39 AM.)
#2  
denzel09's Avatar
Senior Member
Thanks Meter 255
Posts: 2,035
Join Date: Jun 2009
Location: Venice
About dalvik-cache? It remains in phone memory?
 
Taki2011
Old
#3  
Senior Member
Thanks Meter 24
Posts: 254
Join Date: Nov 2011
Location: Cairo
Hi I cant understand How to use it ! any guide ?!
 
dk_zero-cool
Old
#4  
dk_zero-cool's Avatar
Recognized Contributor - OP
Thanks Meter 3465
Posts: 2,385
Join Date: Nov 2010
Location: Horsens
Quote:
Originally Posted by denzel09 View Post
About dalvik-cache? It remains in phone memory?
dalvik-cache remains, so does all of the app related data. Only the APK's is moved.

Quote:
Originally Posted by Taki2011 View Post
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).
  1. Copy/Paste the script content into a file editor and safe the file with the name "99mounts2sd"
  2. Plug your phone to your computer using a usb cable (Select charge only on your phone))
  3. Open a terminal on your computer (In windows use "run" and type "cmd")
  4. Type in shell: "adb shell mount -o remount,rw /system"
  5. Type in shell: "adb push <path to script> /system/etc/init.d/"
  6. Type in shell: "adb shell chmod a+x /system/etc/init.d/99mounts2sd"
  7. 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.
The Following 12 Users Say Thank You to dk_zero-cool For This Useful Post: [ Click to Expand ]
 
dk_zero-cool
Old
#5  
dk_zero-cool's Avatar
Recognized Contributor - OP
Thanks Meter 3465
Posts: 2,385
Join Date: Nov 2010
Location: Horsens
The script has been rewritten. Better checks and more options has been added.
The Following 7 Users Say Thank You to dk_zero-cool For This Useful Post: [ Click to Expand ]
 
denzel09
Old
#6  
denzel09's Avatar
Senior Member
Thanks Meter 255
Posts: 2,035
Join Date: Jun 2009
Location: Venice
Great script

Sent from my GT-S5570 using Tapatalk
 
dyehya
Old
#7  
Recognized Contributor
Thanks Meter 182
Posts: 224
Join Date: Jan 2011

 
DONATE TO ME
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.

Don't have money to donate? Make my DropBox bigger for free!
 
dk_zero-cool
Old
#8  
dk_zero-cool's Avatar
Recognized Contributor - OP
Thanks Meter 3465
Posts: 2,385
Join Date: Nov 2010
Location: Horsens
To see the log, type in the terminal: "logcat | grep mounts2sd". Download a terminal or use ADB.

Also run the command "df -h" to see what is mounted where.

Sent from my HTC Desire using xda premium
Device: Samsung GT-I9300
----------------------------------

The Following User Says Thank You to dk_zero-cool For This Useful Post: [ Click to Expand ]
 
sineld
Old
#9  
Member
Thanks Meter 0
Posts: 47
Join Date: Apr 2011
thanks for the share.
 
dk_zero-cool
Old
#10  
dk_zero-cool's Avatar
Recognized Contributor - OP
Thanks Meter 3465
Posts: 2,385
Join Date: Nov 2010
Location: Horsens
#7 @dyehya

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.

The Following 2 Users Say Thank You to dk_zero-cool For This Useful Post: [ Click to Expand ]