HowTo: use Link2sd with Cyanogenmod 7.0.3

Here’s how I got Link2sd working on Nexus One with Cyanogenmod 7.0.3.

Preamble

I tried everything I found on the web (see here for example), but I had no success.

First of all here are the device details I got from “CurveFish DeviceInfo” app:

[System]
Model: Nexus One
Manufacturer: HTC
Device: passion
Product: passion
Brand: google
Bootloader ver.: 0.35.0017
CPI ABI: armeabi-v7a
CPI ABI 2: armeabi
Hardware: mahimahi
Radio: unknown
Kernel Version: 2.6.37.4-cyanogenmod-01332-g7f230e8
shade@toxygene )
#1 PREEMPT Tue Apr 12 12:54:14 EDT 2011
Build Number: GRI40
Release: 2.3.3
SDK: 10

Prerequisites

  • a PC (mine is powered by Ubuntu 11.04 Natty Narwhal)
  • an usb cable for your mobile
  • adb configured and running on the PC (find more info here)
  • a Nexus One set up with Cyanogenmod 7.0.3 ROM
  • Link2sd app installed from Android Market

The problem

If you try to run Link2sd, you’ll receive these outputs:

 

 

 

 

 

 

The exact message is

mount: mounting /dev/block/vold/179:2 on /data/sdext2/ failed: Device or resource busy

Step by step guide

From your pc, connect the phone via adb (I prefer use bash for easy navigation through terminal).
You have to go to the init scripts path and umount /sd-ext/:
$ adb shell
# bash
localhost / # cd /system/etc/init.d
localhost init.d # ls -lAtr
-rwxr-x--- 1 root shell 925 Aug 1 2008 20userinit
-rwxr-x--- 1 root shell 272 Aug 1 2008 06mountdl
-rwxr-x--- 1 root shell 1452 Aug 1 2008 05mountsd
-rwxr-x--- 1 root shell 201 Aug 1 2008 04modules
-rwxr-x--- 1 root shell 229 Aug 1 2008 03firstboot
-rwxr-x--- 1 root shell 27 Aug 1 2008 01sysctl
-rwxr-x--- 1 root shell 365 Aug 1 2008 00banner
localhost init.d # umount /sd-ext/
localhost init.d #

Now run Link2sd from your phone and repeat the procedure:

 

 

 

 

 

 

Exit app, but don’t restart.
It’s time to restore /sd-ext/ on the phone (via adb) and check if we have the new init script from the app:
localhost init.d # mount /dev/block/mmcblk0p2 /sd-ext/
localhost init.d # cd /system/etc/init.d
localhost init.d # ls -lAtr
-rwxr-x--- 1 root shell 925 Aug 1 2008 20userinit
-rwxr-x--- 1 root shell 272 Aug 1 2008 06mountdl
-rwxr-x--- 1 root shell 1452 Aug 1 2008 05mountsd
-rwxr-x--- 1 root shell 201 Aug 1 2008 04modules
-rwxr-x--- 1 root shell 229 Aug 1 2008 03firstboot
-rwxr-x--- 1 root shell 27 Aug 1 2008 01sysctl
-rwxr-x--- 1 root shell 365 Aug 1 2008 00banner
-rwxr-x--- 1 root root 154 Aug 11 16:26 11link2sd
localhost init.d # cat 11link2sd
#!/system/bin/sh
#added by link2sd
sleep 2
mount -t ext2 -o rw /dev/block/vold/179:2 /data/sdext2
mount -t ext2 -o rw /dev/block/mmcblk0p2 /data/sdext2
localhost init.d #

The script has to be modified as here:
#!/system/bin/sh
#added by link2sd
sleep 2
#mount -t ext2 -o rw /dev/block/vold/179:2 /data/sdext2
#mount -t ext2 -o rw /dev/block/mmcblk0p2 /data/sdext2
#
mount -t ext2 -o bind /sd-ext/ /data/sdext2/

Pay attention to the highlighted parts!

For this purpose you can use vi, but first grant read/write permissions to the filesystem:
localhost init.d # mount -o rw,remount /system/
localhost init.d # vi 11link2sd

Verify your work and restore filesystem permissions:
localhost init.d # cat 11link2sd
#!/system/bin/sh
#added by link2sd
sleep 2
#mount -t ext2 -o rw /dev/block/vold/179:2 /data/sdext2
#mount -t ext2 -o rw /dev/block/mmcblk0p2 /data/sdext2
#
mount -t ext2 -o bind /sd-ext/ /data/sdext2/
localhost init.d # mount -o ro,remount /system/
localhost init.d #

Run the script:
localhost init.d # ./11link2sd
localhost init.d #

Verify Link2sd

Choose an application with a widget (in standard Android system, apps with widget cannot be moved to SD).

For this test I used Evernote.
In Link2sd I clicked the “Create link” button.

 

 

 

 

 

 

Now try to use the widget

 

 

 

 

 

 

Done

 

4 thoughts on “HowTo: use Link2sd with Cyanogenmod 7.0.3

  1. Thanks! I have been trying to get several solutions over the last week (DarkTremor, Simple2Ext, A2SD+, etc) and none of them seemed to work. Link2SD showed me exactly the same error you mention at the top and Google pointed me in the right direction, I don't have ADB running on my Ubuntu PC but CM7 includes a terminal emulator that I was able to use to complete the steps above. Thanks a lot for being able to figure it out and for showing the world what you uncovered.

  2. Thank you @JP. If you want you can help me giving me 250MB of storage in Dropbox. If you can, please register to Dropbox as my referral for free. Here's the link http://db.tt/CxAwoPh.
    If you need something else, try to ask me your question. Bye

Comments are closed.