Introduction

I finally decided to root my HTC Desire phone. I know It’s the first think many people do with their Android phones but since this was my primary phone, I didn’t want do loose my warranty. Now, since it’s long gone I decided to upgrade it. I installed stable release of Cyanogen 7.2 and after fixing GPS (I had to replace HAL library), I had a working phone again.

Problems with Link2SD

I added ext3 partition on my SD card and started moving all the applications to it using Link2SD tool. After doing that I realized that it’s just not enough since I still only had about 80MB of free space on data partition. Quick investigation showed up two things - one is that Link2SD is not linking additional folders inside inside of applications directories so for example fennec had huge files and cache directories. Second is that I had something like 40MB of files in dalvik-cache directory even after moving all non-system apps to SD card.

Solution

I haven’t made an automatic solution for the first problem yet. I just made manual links for two biggest apps and that’s enough for now. I god rid of dalvik-cache problem, however.

Since I have something like 100MB of free space on /system/ partition, I decided to make use of it. I could use some custom made HBOOT that changes partitions sizes but somehow, I don’t like flashing bootloaders when I don’t have to. So instead of doing that, I made a little trick:

# cat /etc/init.d/07cache2system 
#!/system/bin/sh

if [ -d /system/dalvik-cache/ ]; then
  mount -o bind /system/dalvik-cache /data/dalvik-cache
  mount -o remount,rw /data/dalvik-cache/
fi

Notice I only make /data/dalvik-cache bind mount writable, I preferred to leave rest of the /system/ data read-only. After rebooting I had to remove old cache directory:

mkdir /dev/1/
mount /dev/block/mtdblock5 /dev/1
rm /dev/1/dalvik-cache/*
umount /dev/1/

And now I had about 40MB more free space on data partition without sacrificing performance or the need for reflashing bootloader.