CyanogenMod and Link2SD –

I’m a big fan of smartphones – have been ever since the first Windows PDAs.  I guess it must have been the well styled user interface (!), or the convenient portability of a house brick! Well, how things have progressed since then…

I’m definitely a fan of Android – the move from Windows Mobile to Android was not a difficult one, and I feel I chose a great phone on which to make the move, the Google Nexus One.  To this day, I’ve still got the Nexus One and there’s very little I want for.  Yes, it would be nice to have a front-facing camera; perhaps an HDMI-out; NFC looks to be gaining speed too…  By far the most frustrating thing about the Nexus One, however, is its tiny internal memory.  You can barely fit any apps on its swiss-cheese of a brain.

That’s where Link2SD comes in – essentially a more configurable version of Apps2SD, allowing you to move all apps to the SD card, but to do this selectively.  For instance, I leave my important apps on the internal memory, but move anything that’s not quite so important to the SD card.  Oh, and by the way, this is to a separate space on the SD card so even widgets will work when you move the associated apps.  Remember that annoying artefact of using the built in “Move to SD” functionality only to find that you can no longer use the associated widget?

Anyway, installation is relatively easy.  You’ll need a rooted device, I’m afraid, and you’ll need to partition your SD card, so that you have a space in which the apps can live.  If you’ve rooted, you likely have ClockworkMOD Recovery.  Boot yourself into that, by holding volume-down whilst turning on the phone.  In the advanced menu, you’ll find an option to partition sd card.  Select it – remember that this will wipe everything from your SD card so be sure to have a backup.  I suggest selecting 1024MB ext size and 0mb cache from the options.

Once you’re done, reboot into android and download Link2SD from the android market.  Once you have it, launch it and it will attempt to create a script to make the new partition you created on your SD card available at boot.  This is where, if you have CyanogenMod (as you likely do), you’ll hit the first stumbling block.

Link2SD wants to create a folder at /data/sdext2 that links to the partition on your SD card.  By default, however, CyanogenMOD has already mounted your new partition at /sd-ext.  As soon as Link2SD attempts to mount this already mounted partition an error is thrown (you can’t mount a partition to two locations like this):

Mount script error
Mount script cannot be created.
mount: mounting /dev/block/vold/179:2 on /data/sdext2 failed: Device or resource busy

To solve this, you’re going to need to go into the Terminal application available in the app drawer (you could also use ADB, which will allow you to do this on a computer rather than your tiny android phone, but you don’t have to do this).  The easiest fix is to manually create the script that Link2SD requires.  Linux (and Android, which is based on Linux) looks in /etc/init.d/ for scripts that run at bootup, so this is where you’ll be looking to place the script that will mount the sd card partition in the location that Link2SD expects it.  So, let’s get going – in terminal, type the following:

cd /etc/init.d/
su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
echo “#!/system/bin/sh” > ./11link2sd
echo “mount -t ext3 -o bind /sd-ext/ /data/sdext2/” >> ./11link2sd
chmod 750 ./11link2sd

Reboot your phone and you can start using Link2SD.  Check it’s working by going into Link2SD and choosing Storage Info from the menu.  If you can see space available on “SD Card 2nd Part”, you’re golden.

Enjoy Link2SD!

6 thoughts on “CyanogenMod and Link2SD –

  1. Christian – it should work on any phone running Cyanogenmod but bear in mind that this is a fix to a problem with Link2SD so you will actually need to install Link2SD first from the market :)

    Saket – thanks, glad it helped!

  2. oh i tried it to mount my third ext2 partition over my sd card(as link2sd always mounts second one). but it didn’t helped. after changing this script or one another .sh script under /data/data/link2sd, it is still mounting the same partition. but at least i get to know something new about link2sd due to this article. finally i mounted second partition only.
    thanks.

  3. Hi all,
    I want to use JB 4.2.2 on my Nexus One using CM 10.1, and because that leaves me with very little internal memory, I need to get Link2SD to work.
    So I just tried to follow the above instructions – but I still get the error message that the device is busy. Does anyone happen to know whether one or more paths have changed in JB?
    If so, I’d greatly appreciate your input regarding this!
    Thanks & regards,
    Axel

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>