[Q&A] Mounts2SD - Storage & Memory Management

Search This thread

dk_zero-cool

Senior Member
Nov 6, 2010
3,529
4,996
Horsens
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.

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.
 

dyehya

Senior Member
Jan 31, 2011
237
191
Samsung Galaxy Note 10+
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.
 

dk_zero-cool

Senior Member
Nov 6, 2010
3,529
4,996
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
 
  • Like
Reactions: Tytanium

dk_zero-cool

Senior Member
Nov 6, 2010
3,529
4,996
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.
 
  • Like
Reactions: herry165 and dyehya

dyehya

Senior Member
Jan 31, 2011
237
191
Samsung Galaxy Note 10+
I am not sure what is going on in boot. I just saw your replies and haven't had a chance to update the script and mess with the phone. I do know that when I was playing with it before it kept using the busybox minimal that was in the kernel loaded in sbin I tried copying your version of busybox into bin and xbin (and now reverted back) but it would still use the one in sbin. What I would really like to do and would recommend is you design the script where you can put busybox in a certain location and the script will use that version over any other versions. I am still learning with all this and despite being able to create the files throw them in the correct places I don't know the code well enough to do this myself. Thanks again for all your help.
 

dk_zero-cool

Senior Member
Nov 6, 2010
3,529
4,996
Horsens
Ok i have changed the script so that it now forces the usage of /system/xbin/busybox or /system/bin/busybox and ignores /sbin/busybox

Place a full busybox version in one of the system bin folders, update the script and see what happends.

Otherwise paste a copy of "df -h" and "cat /data/mounts2sd.log | grep mounts2sd" here so that I can see what it does during boot.
 
  • Like
Reactions: dyehya

virus2013

Senior Member
Jan 17, 2009
310
19
Waimes
www.jrousseau.be
Thanks for this. Just flashed the ICS beta 0.1 with your a2sd embedded. Just a suggestion, I added $CMD_CHMOD 777 $CMD_BUSYBOX at line 260, just after the affectation of CMD_BUSYBOX.
For now, it seems to work very well !
 

dk_zero-cool

Senior Member
Nov 6, 2010
3,529
4,996
Horsens
Thanks for this. Just flashed the ICS beta 0.1 with your a2sd embedded. Just a suggestion, I added $CMD_CHMOD 777 $CMD_BUSYBOX at line 260, just after the affectation of CMD_BUSYBOX.
For now, it seems to work very well !

That I don't get? $CMD_CHMOD is undefined at line 260 and why use busybox to change permissions on itself?
 

virus2013

Senior Member
Jan 17, 2009
310
19
Waimes
www.jrousseau.be
That I don't get? $CMD_CHMOD is undefined at line 260 and why use busybox to change permissions on itself?

Sorry, I'm tired... :-\
In fact, I just wanna be sure that the busybox in /system/bin was executable as I pushed it into the rom zip. And as chmod was already used upper, I was thinking it could be a good idea. However, I'm not a script writer! ;-)

Sent from my Desire running ICS
 

jukyO

Senior Member
Feb 2, 2011
2,747
619
Ogulin
OnePlus One
OnePlus 2
Hello Cool,

trying ICS with your script. Here is the output of logcat an df -h command:

Code:
# cat /data/mounts2sd.log | grep mounts2sd
cat /data/mounts2sd.log | grep mounts2sd
12-14 13:05:12.905 V/mounts2sd(   96): Initiating Mounts2SD (v:1.1.1)...
12-14 13:05:12.985 V/mounts2sd(  101): Including configuration file...
12-14 13:05:14.897 V/mounts2sd(  212): Searching for sdcard...
12-14 13:05:15.277 V/mounts2sd(  231): Searching for sd-ext partition (/dev/block/mmcblk0p2)...
12-14 13:05:16.198 V/mounts2sd(  254): sd-ext partition was mounted successfully...
12-14 13:05:16.728 V/mounts2sd(  278): Moving /data/app to /sd-ext/app...
12-14 13:05:17.049 V/mounts2sd(  297): Moving /data/app-private to /sd-ext/app-private...
12-14 13:05:17.209 V/mounts2sd(  305): Searching for the sd-cache partition (/dev/block/mmcblk0p3)...
12-14 13:05:18.050 V/mounts2sd(  326): sd-cache was mounted successfully...
12-14 13:05:18.280 V/mounts2sd(  335): A device is already mounted at /cache. Umounting it...
12-14 13:05:18.420 V/mounts2sd(  341): Moving /cache to /sd-cache...
12-14 13:05:18.440 V/mounts2sd(  342): Done!

df -h
Filesystem                Size      Used Available Use% Mounted on
tmpfs                   202.9M     32.0K    202.9M   0% /dev
tmpfs                   202.9M         0    202.9M   0% /mnt/asec
tmpfs                   202.9M         0    202.9M   0% /mnt/obb
/dev/block/mtdblock3    250.0M    165.0M     85.0M  66% /system
/dev/block/mtdblock5    147.6M     62.4M     85.2M  42% /data
/dev/block/mmcblk0p2    960.7M      1.2M    959.4M   0% /sd-ext
/dev/block/mmcblk0p2    960.7M      1.2M    959.4M   0% /data/app
/dev/block/mmcblk0p2    960.7M      1.2M    959.4M   0% /data/app-private
/dev/block/mmcblk0p3    295.9M    168.0K    295.8M   0% /sd-cache
/dev/block/mmcblk0p3    295.9M    168.0K    295.8M   0% /cache
/dev/block/vold/179:1
                          6.2G      4.6G      1.6G  75% /mnt/sdcard
/dev/block/vold/179:1
                          6.2G      4.6G      1.6G  75% /mnt/secure/asec

This looks good, can you please confirm?
Also, why is /data not on ext partition but on phone memory?

Thanks for the script though!

Cheers, keep up the good work.
 

dk_zero-cool

Senior Member
Nov 6, 2010
3,529
4,996
Horsens
This looks good, can you please confirm?
Also, why is /data not on ext partition but on phone memory?

Thanks for the script though!

Cheers, keep up the good work.

That looks as it should.

The whole /data is not moved to the /sd-ext for that simple reason that there are no hboot out there with 0mb /data.

I have options in my script to move both the .apk files (The applications) and the dalvik-cache which are the biggest things in the /data partition. If I moved everything to sd-ext, there would be nothing using the remaining space available on the internal data which is a waste of good space. It's like having an extra room in your house that is not used for anything at all. If we have to have it, we might as well use it :)

BTW:
You don't have dalvik-cache aktivated. So if you ever need more space on /data, activate it in /system/etc/mounts2sd.conf
 
Last edited:
  • Like
Reactions: uzi2 and jukyO

uzi2

Senior Member
Jun 6, 2008
2,528
638
BTW:
You don't have dalvik-cache aktivated. So if you ever need more space on /data, activate it in /system/etc/mounts2sd.conf

Could you provide an example mounts2sd.conf file, so that all settings could be established at first boot. This would make it much easier when updating ROMS.
 

Dunc001

Inactive Recognized Developer
Apr 6, 2010
2,705
1,462
Hiding out south of the border...
Could you provide an example mounts2sd.conf file, so that all settings could be established at first boot. This would make it much easier when updating ROMS.

You don't need a .conf file now - it's not used. You simply install the zip and then use the m2sd commands in terminal to make changes (see instructions in OP - type m2sd help for more info)
 
  • Like
Reactions: uzi2

dk_zero-cool

Senior Member
Nov 6, 2010
3,529
4,996
Horsens
Could you provide an example mounts2sd.conf file, so that all settings could be established at first boot. This would make it much easier when updating ROMS.

The config files is deprecated and replaced with the "m2sd" command, as said above. Settings is saved to /data/.m2sd which means that it keeps your settings when you flash new ROM's as long as you don't wipe data.
 
  • Like
Reactions: uzi2

Top Liked Posts

  • There are no posts matching your filters.
  • 276
    Mounts2SD - Storage & Memory Management

    The Opening Post (OP) has been moved to a new DevDB Section

    This Thread has been assigned as an Q&A.
    You should see a new pane above where you can navigate this project.
    16
    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.

    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.
    13
    Within a week or so, I will release a new major update of Mounts2SD, which will contain


    1. New Re-written script with additional new option
      1. Seperate option for app libraries (Android 4.x)
      2. New option to move /data/media (The new type of internal sdcard used on Samsung among others)
      3. Ability to enable ZRAM
      4. Ability to set preferred scheduler on external and internal MMC
      5. Ability to also set readahead on internal MMC
      6. Ability to set preferred storage threshold, or disable it (Instead of hard coded value)
      7. The finalising part has been added to a sub-process which is started by the app itself. This is no longer depended on the app to execute it after boot
      8. Default values will be configured based on the device and it's abilities
      9. And more....
    2. New Re-written app
      1. Live overview (No more pre-defined onboot status properties)
      2. New layout
        1. 3 different layout's for small phones screens, normal phone screens and tablet screens (And of cause different landscape/portrait layouts for each of them)
      3. Only allow the owner to control the script (Android 4.2 multi-user)
      4. New Re-written RootFW (Spazedog Root Framework)
      5. New and better extended AsyncTask for background loading
      6. Overview and Configure will now adapt to the abilities available on the device (For an example, SWAP will not be displayed at all on devices without SWAP suppport)
      7. And more...


    However, before this is finished, I would like it very much if someone could provide me with a version of /system/etc/recovery.sh after Link2SD has added whatever content it adds to this file, so that I can update the auto sd-ext deletion script to better remove Link2SD from a device. I have tried installing Link2SD on two of my test devices, but on neither was anything added to this file. So for now I have just update the deletion script to also include the Link2SD app, which should take care of most of the problems when migrating from this.
    9
    Test Package Available

    I have added a test package to the OP under the category "Testing Downloads" containing a preview of the upcoming version. This package is NOT a recovery package. It is just an archive containing the app and the script, you will have to manually copy the script to the init.d location (Not yet implemented in the app) and you will have to manually configure the script using the /data/property/m2sd.* files (also, not yet implemented in the app). There are two APK's in the package which uses two different themes (will be changeable in the app when it is done).

    The script should be finished, I have used it myself for the past month, but some more test devices would not hurt. The app however still have some work to be done. The overview is working fine, but I have yet to add some persistent storage for the configurations, so there will be a lot of loading each time you open it. Also there is still no configurations, no log viewer and no app settings for script installation, theme changer and so fourth.

    This is only meant for some early testing, mostly to test the script. It is not a finished product, so don't provide bug reports about missing app features, extensive app loading, missing Aroma installer and so on. All will be available soon. At this point I am only interested in script issues and possible issues with the app overview screen.

    The Script

    • Move Applications, Application Data, Application Libraries, Dalvik-cache and Data Media (Internal Storage) to sd-ext
    • Supports any file system type supported by the kernel
    • Handles Unix Lost+Found folder content to avoid having it take up to much disk usage
    • Supports SWAP and ZRAM (If kernel supports it)
    • Move the main cache partition to data or sd-ext, depending on available space
    • Change storage threshold to minimize the Android low storage market issue
    • Set Readahead and Scheduler for both internal and external MMC
    • Sets optimized mount parameters on the internal partitions
    • Safe-mode and new alternative work-around for service implemented init.d ROM's
    • Compares content with available disk space before moving content around to avoid corrupted data
    • More than a half dozen mount operations to ensure successful sd-ext mount, despite possible issues
    • File system check and repair
    • Enable/Disable ext4 journal
    • Supports storing system applications on /data and /sd-ext
    • A large number of different safe guards to avoid all kinds of thinkable issues
    • Fully adapts to different shell environments
    • 100% functional programming structure (Much better code overview)
    • Properly more...

    The APP

    • Fully working live overview (No more comparing static status properties)
    • Uses my TaskManager project (Handles background work much better)
    • Uses my latest RootFW from the development branch
    • Contains 5 different tab layouts which will be used depending on screen size and rotation
    • Contains both a light and dark theme
    9
    New release is out, and Play Store is finally updated as well. Just missing the recovery package, which I will have ready during the weekend.

    One notice about this release.
    I have added an additional tab entry with the feature of converting apps into system apps. This feature is a paid one, as this seamed like a good way of adding some donations. And because this is only more or less meant as a donation, the downloads on XDA is fully unlocked. Just note that if you install or update from Play Store, you will get a locked version without this additional feature.

    Also, the current feature is only a small start. I am going to add more individual application features to this tab.