• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root [FAQ]ROOT MEMORY: a2sd+ / partitions (updated 10th August 2011)

I really couldnt face the whole bother of installing a new ROM even though I really wanted to solve my problem with most of my programs vanishing while my phone is connected to my compyer (very often) and having to wait 5 minutes after disconnetcing for them to come back.

But......today, the excellent Anrdoid Police website pointed me in the direction of an app which allows the SD card of rooted phones to be connected to the phone and the computer at the same time!!!

The name of the app is Dual Mount SD Widget and you can read about it here. Mount Your SD Card To Your Phone And PC At The Same Time With Dual Mount SD Widget | Android News, Apps, Games, Phones, Tablets - Android Police
 
Upvote 0
Do you have an 06mountdl script or similar in /system/etc/init.d, i.e. something binding /cache/download to a directory in /data? I've found that when using ROMs that work that way Quick System Info does that (of course it could be QSI version, if that was updated at the same time I switched to CM7 - I don't remember that, but it's possible).

But the scripts I'm familiar with wouldn't link like that with a 40MB /cache partition, so this theory doesn't quite fit.
 
Upvote 0
I tried an app like that but I didnt like the idea of dual mounting. do be careful :)

I guess you might b right and dont want to take the risk, especially because I tend to write large files onto my SD card which take a while to transer hence increasing the amount of time the SD card could be corrupted in!

I'm therefore thinking of taking the plunge. I know that I turned my SD card into a goldcard before I rooted, but is there any way I can check that it is still working before I take the plunge of installign a custom ROM?

Thanks!
 
Upvote 0
Anyone without an apps2sd script (or non init.d supporting rom), who has a partitioned SD card want to try this out for me please? If it works no need to add init.d support to a stock rom for a2sd support.

Download script manager from the market: https://market.android.com/details?id=os.tools.scriptmanager&feature=search_result

Open it and create a new script with "run as root" and "run at boot" set, then copy the below code into the new script.

Code:
#!/system/bin/sh

enablea2sd () {
    # mount and set perms
    busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /sd-ext;
    busybox chown 1000:1000 /sd-ext;
    busybox chmod 771 /sd-ext;

    # clean up any old symlinks, create data directories
    for i in data;
    do
        if [ -h /data/$i ];
        then
            rm /data/$i;
        fi;
        if [ ! -d /data/$i ];
        then
            mkdir /data/$i;
            busybox chown 1000:1000 /data/$i;
            busybox chmod 771 /data/$i;
        fi;
    done;

    # don't allow /data/data on sd because of upgrade issues - move it if possible
    if [ -d /sd-ext/data ];
    then
        busybox cp -a /sd-ext/data/* /data/data/;
        busybox rm -rf /sd-ext/data;
    fi;

    # move apps from internal memory to sdcard
    for i in app app-private dalvik-cache;
    do
        if [ ! -d /sd-ext/$i ];
        then
            mkdir /sd-ext/$i;
        fi

        busybox chown 1000:1000 /sd-ext/$i;
        busybox chmod 771 /sd-ext/$i
        
        if [ -d /data/$i ] && [ ! -h /data/$i ];
        then
            busybox cp -a /data/$i/* /sd-ext/$i/;
            busybox rm -f /data/$i/*;
        fi;
    done;

    # symlink app dirs - they must be on the same filesystem
    for i in app app-private dalvik-cache;
    do
        if [ -d /data/$i ] && [ ! -h /data/$i ];
        then
            busybox rm -rf /data/$i;
            busybox ln -s /sd-ext/$i /data/$i;
        fi;
    done;

    # clean up old whiteouts
    for i in local misc property system tombstones data;
    do
        if [ -h /sd-ext/$i ]; then rm -f /sd-ext/$i; fi
    done;

    # please don't put odex files in the app directory people!
    # it causes dexopt to crash when switching builds!
    busybox rm -f /sd-ext/app/*.odex
    
    echo "+++ Apps-to-SD successfully enabled";

}

disablea2sd() {    # replace symlinks with directories so we can boot without sd
    for i in app app-private dalvik-cache;
    do
       if [ -h /data/$i ];
       then
            rm -f /data/$i;
            mkdir /data/$i;
            busybox chown 1000:1000 /data/$i;
            busybox chmod 771 /data/$i;
        fi;
    done;
}


if [ -e /dev/block/mmcblk0p1 ]; # We check for the presence of the FAT partition first to see if the SD has initialised.
    then
    echo "SD Card has been initialised...checking for ext partition.";
        if  [ -e /dev/block/mmcblk0p2 ]; # If false, it isn't there so we don't have to sleep the script and delay the boot.
        then
            enablea2sd;
        else
            echo "No ext partition present, apps2sd disabled";
            disablea2sd;
        fi;
        
    else
        sleep 4; #Enables time for a slow SD to be detected and populate the device nodes.
        if [ -e /dev/block/mmcblk0p2 ];
            then
                echo "enablea2sd for slow SD card";
                enablea2sd;
            else
                echo "No ext partition present after sleep, apps2sd disabled";
                disablea2sd;
            fi;
    fi;

sync;

After a reboot this should enable apps2sd.

My init.d support has gone screwy and no longer works, but all the scripts I use run this way, but its good news if a2sd+ will run this way too.

Lemme know.
 
Upvote 0
Anyone without an apps2sd script (or non init.d supporting rom), who has a partitioned SD card want to try this out for me please? If it works no need to add init.d support to a stock rom for a2sd support.

Download script manager from the market: https://market.android.com/details?id=os.tools.scriptmanager&feature=search_result

Open it and create a new script with "run as root" and "run at boot" set, then copy the below code into the new script.

Code:
#!/system/bin/sh

enablea2sd () {
    # mount and set perms
    busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /sd-ext;
    busybox chown 1000:1000 /sd-ext;
    busybox chmod 771 /sd-ext;

    # clean up any old symlinks, create data directories
    for i in data;
    do
        if [ -h /data/$i ];
        then
            rm /data/$i;
        fi;
        if [ ! -d /data/$i ];
        then
            mkdir /data/$i;
            busybox chown 1000:1000 /data/$i;
            busybox chmod 771 /data/$i;
        fi;
    done;

    # don't allow /data/data on sd because of upgrade issues - move it if possible
    if [ -d /sd-ext/data ];
    then
        busybox cp -a /sd-ext/data/* /data/data/;
        busybox rm -rf /sd-ext/data;
    fi;

    # move apps from internal memory to sdcard
    for i in app app-private dalvik-cache;
    do
        if [ ! -d /sd-ext/$i ];
        then
            mkdir /sd-ext/$i;
        fi

        busybox chown 1000:1000 /sd-ext/$i;
        busybox chmod 771 /sd-ext/$i
        
        if [ -d /data/$i ] && [ ! -h /data/$i ];
        then
            busybox cp -a /data/$i/* /sd-ext/$i/;
            busybox rm -f /data/$i/*;
        fi;
    done;

    # symlink app dirs - they must be on the same filesystem
    for i in app app-private dalvik-cache;
    do
        if [ -d /data/$i ] && [ ! -h /data/$i ];
        then
            busybox rm -rf /data/$i;
            busybox ln -s /sd-ext/$i /data/$i;
        fi;
    done;

    # clean up old whiteouts
    for i in local misc property system tombstones data;
    do
        if [ -h /sd-ext/$i ]; then rm -f /sd-ext/$i; fi
    done;

    # please don't put odex files in the app directory people!
    # it causes dexopt to crash when switching builds!
    busybox rm -f /sd-ext/app/*.odex
    
    echo "+++ Apps-to-SD successfully enabled";

}

disablea2sd() {    # replace symlinks with directories so we can boot without sd
    for i in app app-private dalvik-cache;
    do
       if [ -h /data/$i ];
       then
            rm -f /data/$i;
            mkdir /data/$i;
            busybox chown 1000:1000 /data/$i;
            busybox chmod 771 /data/$i;
        fi;
    done;
}


if [ -e /dev/block/mmcblk0p1 ]; # We check for the presence of the FAT partition first to see if the SD has initialised.
    then
    echo "SD Card has been initialised...checking for ext partition.";
        if  [ -e /dev/block/mmcblk0p2 ]; # If false, it isn't there so we don't have to sleep the script and delay the boot.
        then
            enablea2sd;
        else
            echo "No ext partition present, apps2sd disabled";
            disablea2sd;
        fi;
        
    else
        sleep 4; #Enables time for a slow SD to be detected and populate the device nodes.
        if [ -e /dev/block/mmcblk0p2 ];
            then
                echo "enablea2sd for slow SD card";
                enablea2sd;
            else
                echo "No ext partition present after sleep, apps2sd disabled";
                disablea2sd;
            fi;
    fi;

sync;
After a reboot this should enable apps2sd.

My init.d support has gone screwy and no longer works, but all the scripts I use run this way, but its good news if a2sd+ will run this way too.

Lemme know.

I'm more than happy to try this.

Two questions though.

There's far too much text to copy easily on Android. Any way I can do this on my desktop?

How safe is this?!
 
Upvote 0
It's safe but take a nandroid first.

You can only do it on android cause you have to paste it into an app. You can just do select all though.

Thanks for trying this. Will be most interesting

Stuggling to copy and paste from Gmail.

Even that bit which I did manage to copy in full, when I paste it in script manager it clumps all the text together in one big unuseable jumble!

I away from my computer now. I can try again on Sunday morning, if you are around to hold my hand if things go wrong!
 
Upvote 0
How much space is used in Quick system info for a2sd? Has internal memory increased or is it the same?

Maybe it just needs to run sooner than script manager can run it, which is something that worried me.

Assume you've rebooted since?

Sure I have.

Actually, in system quick info I have A2SD showing even before I run your script. Don't know whether this means anything!


Here are the figures reported by Quick Info after your script is running:
A2SD Total 4.03 free 3.58
Internal 148 free 17.2
 
Upvote 0
Sure I have.

Actually, in system quick info I have A2SD showing even before I run your script. Don't know whether this means anything!


Here are the figures reported by Quick Info after your script is running:
A2SD Total 4.03 free 3.58
Internal 148 free 17.2

What???!!!!!

Its changing every time I look at it!!!

now it's reporting
A2SD total 108 free 53.06

And now (maybe after it's finsihed loading everythign from SD card) its the follwing:
A2Sd total 171 free 85.86
 
Upvote 0
SURoot:

Guess what?!!

I just dropped my phone down the toilet, and sure thing, it won't get past the bootloader screen.

No probs however, as orange will be delivering a new one in the morning!

And thanks to you, I have a nice bang up to date backup to get my old info off once I have rooted my new phone. Thank you!!

The backup I took before helping you try your script, ended up helping me keep my phone info!!

You are a star! :)
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones