Apps2cd on the droid anyone?

Discussion in 'Android Hacks and Help' started by forkup, Mar 25, 2010.

  1. forkup
    Offline

    forkup New Member

    Joined:
    Oct 31, 2009
    Messages:
    317
    Likes Received:
    0
    Trophy Points:
    0
    This was performed on ClockworkMod 5.0.5.3 with Bekits modules installed on a rom that had been in use a few days since a wipe.

    Do any or all of this at your own risk, I assume no responsibility if you brick your device.

    Parts of this tutorial were taken from A2SD - android-roms - How To: Apps 2 SD - Project Hosting on Google Code

    This is mostly a proof on concept for the droid as I don't actually need the space on /data myself and clockworkmod already moves the dalvik-cache from /data to /cache, I just hadn't seen where anyone else had this working and had some time to waste :)

    First partition your sdcard with either 2 or 3 partitions according to whether you also want to use swap.

    Use gparted under linux or Paragon hard disk manager under windows to create the partitions. We will have parted on clockworkmod recovery soon.

    The decision to use ext2 or ext3 is up to you, I also tried ext4 but ran into problems loading the module.

    I have an 8 gig class 6 card so I allocated 7 gigs as FAT32 which must be the first partition on the sdcard.

    Next I created an ext3 partition of 512 MB and created the remaining space as swap.

    The partitions need to be in that order...FAT32, ext3, then swap if you want to use it.

    Once you boot into android the ext3 partition is automatically mounted for you at /sd-ext. df -h shows this:

    # df -h
    df -h
    Filesystem Size Used Available Use% Mounted on
    tmpfs 112.4M 0 112.4M 0% /dev
    tmpfs 4.0M 0 4.0M 0% /sqlite_stmt_journals
    /dev/block/mtdblock4 140.4M 136.4M 4.0M 97% /system
    /dev/block/mtdblock6 261.8M 89.3M 172.4M 34% /data
    /dev/block/mtdblock5 92.6M 35.7M 57.0M 39% /cache
    /dev/block/mtdblock0 1.5M 1.1M 360.0K 77% /config
    /dev/block//vold/179:1
    7.0G 5.4G 1.7G 76% /sdcard
    /dev/block/mmcblk0p2 509.6M 50.1M 433.6M 10% /sd-ext

    Type mkswap /dev/block/mmcblk0p3 in the shell to set up swap.

    I use a script named userinit.sh to mount the swap, here are it's contents:

    #!/system/bin/sh
    #
    partition=3 #partition number of swap partition. Change if swap is not partition 3
    swappy=30 #swappiness. larger number = more likely to swap, smaller number = less
    swapon /dev/block/mmcblk0p$partition;
    sysctl -w vm.swappiness=$swappy;
    exit 0;

    Copy it to /sd-ext to have it run on boot. free shows this after running the script:

    # free
    free
    total used free shared buffers
    Mem: 230224 226828 3396 0 6380
    Swap: 40152 1100 39052
    Total: 270376 227928 42448

    If the Swap: line above shows all zeroes you did something wrong, go back and check your work.

    ClockworkMod already moves dalvik-cache from the /data partition to the /cache partition.

    If you wish to move it to the sdcard (along with app-private, /data/data and /data/lost+found) you can by following the optional commands below.

    Now to copy the files over:
    busybox cp -a /data/app /sd-ext
    busybox cp -a /data/app-private /sd-ext (optional and not recommended)
    busybox cp -a /data/dalvik-cache /sd-ext (optional)
    busybox cp -a /cache/dalvik-cache /sd-ext (optional)
    busybox cp -a /data/data /sd-ext (optional)

    Once this is all done to your liking reboot to recovery and using adb shell execute the following commands:

    mount data
    rm -r /data/app
    ln -s /sd-ext/app /data/app
    rm -r /data/data (optional)
    ln -s /sd-ext/data /data/data (optional)
    rm -r /data/dalvik-cache (optional)
    rm -r /cache/dalvik-cache (optional)
    ln -s /sd-ext/dalvik-cache /data/dalvik-cache (optional)
    reboot

    YOU MUST RUN THE OPTIONAL COMMANDS IN BOTH SECTIONS FOR THEM TO WORK, OR RUN THEM IN NEITHER!!!

    During the reboot process your phone might take a while at the android screen since it has to populate the apps tray.

    If it takes longer than 5-10 minutes then something likely went wrong. Make sure you did all the steps correctly.

    Here's a df -h after the setup:

    df -h
    Filesystem Size Used Available Use% Mounted on
    tmpfs 112.4M 0 112.4M 0% /dev
    tmpfs 4.0M 0 4.0M 0% /sqlite_stmt_journals
    /dev/block/mtdblock4 140.4M 136.4M 4.0M 97% /system
    /dev/block/mtdblock6 261.8M 4.3M 257.4M 2% /data
    /dev/block/mtdblock5 92.6M 21.8M 70.9M 23% /cache
    /dev/block/mtdblock0 1.5M 1.1M 360.0K 77% /config
    /dev/block/mmcblk0p2 509.6M 133.0M 350.7M 27% /sd-ext
    /dev/block//vold/179:1 7.0G 5.6G 1.4G 80% /sdcard

    Hopefully this works for you as it did for me, enjoy having your apps on the sdcard.

    I just completed all this on my droid and state nothing to the effect of any performance gains, as I said at the start this is proof of concept. Use any or none of it, that's up to you the user.
     

    forkup
    Last edited: Mar 27, 2010
  2. adrynalyne
    Offline

    adrynalyne Premium Member Premium Member Developer

    Joined:
    Dec 21, 2009
    Messages:
    2,896
    Likes Received:
    4
    Trophy Points:
    0
    I recommend not trying this until you have a class 6 card, but to each their own.
  3. TekHawk
    Offline

    TekHawk New Member

    Joined:
    Dec 21, 2009
    Messages:
    783
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Yuba ****ty, California
    anyone gets this working on a ese53 rom let me know the swap space part of it seems like a good idea to me atm
  4. forkup
    Offline

    forkup New Member

    Joined:
    Oct 31, 2009
    Messages:
    317
    Likes Received:
    0
    Trophy Points:
    0
    I can assure you it works fine in fact I'm surprised there isn't more of a performance hit than I'm seeing. As to the swap I've had it working close to 20 hours with no noticeable slowdown contrary to my experiences with 2.01 roms.
  5. adrynalyne
    Offline

    adrynalyne Premium Member Premium Member Developer

    Joined:
    Dec 21, 2009
    Messages:
    2,896
    Likes Received:
    4
    Trophy Points:
    0
    I never had slowdowns with 2.0.1 roms. Unless you are referring to compcache, which is 100% different than this.
  6. TekHawk
    Offline

    TekHawk New Member

    Joined:
    Dec 21, 2009
    Messages:
    783
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Yuba ****ty, California
    You are running it on Cyanogen though which is not a ESE53 rom there are a lot of things there work on cyanogen that wont on ESE53 without loading in extra Cyanogen file that could cause breakage with other parts of the system

    thats why i was saying if anyone gets this to work on a ESE53 rom to let me know :) I dont have time this week to risk stablity playing with something like this :(
  7. forkup
    Offline

    forkup New Member

    Joined:
    Oct 31, 2009
    Messages:
    317
    Likes Received:
    0
    Trophy Points:
    0
    It literally would take an hour to test.
  8. forkup
    Offline

    forkup New Member

    Joined:
    Oct 31, 2009
    Messages:
    317
    Likes Received:
    0
    Trophy Points:
    0
    Yes in fact I was thinking of compcache, I've never tried swap before.
  9. adrynalyne
    Offline

    adrynalyne Premium Member Premium Member Developer

    Joined:
    Dec 21, 2009
    Messages:
    2,896
    Likes Received:
    4
    Trophy Points:
    0
    compcache is a kernel feature. Just an fyi.
  10. teenfaces
    Offline

    teenfaces New Member

    Joined:
    Nov 12, 2009
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    0
    I just used the apps2sd option in the manage applications cyanogen added in 5.0.5.3, no special code required.
  11. forkup
    Offline

    forkup New Member

    Joined:
    Oct 31, 2009
    Messages:
    317
    Likes Received:
    0
    Trophy Points:
    0
    Ok upon further testing you have to create the ext partition yourself then in settings-applications you can enable apps2sd and from then on if you have that box checked new app installs go to /sd-ext.
Search tags for this page
/dev/block/mmcblk0p3: function not implemented
,
android lsattr function not implemented
,

apps2cd

,
rezound mmcblk0p
,
swapon /dev/block/mmcblk0p2 function not implemented
,
swapon /dev/block/mmcblk1p2 function not implemented
,

swapon: /dev/block/mmcblk0p3: function not implemented

,
swapon:+/dev/block/zram0:+function+not implemented