[Desire Q&A, Help & Troubleshooting] sibere:
More space, more I/O

Howto for a HTC desire, Stock ROM 2.2, clockworkmod recovery.

What you need is:

* Fast µSD card (the faster the better)

* Latest busybox build (http://www.busybox.net/downloads/binaries/1.17.2/busybox-armv6l)

* Kernel with loop and EXT2/3/4 support

* If you already have app2sd+ or a similar script, don't do the following hack (or at your own risks) !!

* If you still want to try it, backup your A2SD scripts and roll-back to a pre-A2SD state.

1/Get prepared

A/ backup everything.

B/ Make sure everything is backed-up

C/ Copy the content of you SD to your computer and keep it handy for a roll-back.

D/ make a copy !!!! (I think know that you've been warned ;) )

2/ Make 2 partitions on your SD

Partition 1 will be your usual storage, must be FAT32.

If you want to optimize it, have a look here : http://www.patriotmemory.com/forums/showthread.php?t=3696

Partition 2 will be your new storage (/DATA) and optionally swap space and must be FAT32 too. Problems have been reported with Market when the partition is too big. 1GB sould be more than enough and worked well for all users.

You can use gparted or fdisk (I do prefer Fdisk because of the expert mode ;) )

3/ Boot your phone in recovery

Connect to your phone with "adb shell"

mount your /system, /data /sdcard via the shell (not the recovery menu!)

Replace you old busybox exec with the new one. It's located in /system/xbin/

now you're ready to go!

4/ Instant of creation

rename 01data.txt to 01data ("mv 01data.txt 01data") and copy this script to /system/etc/init.d and do a "chmod 755" on it.

"755" is not highly secure, but you're the only user anyway, don't you? ;)

This script is mounting the new file as a ext2/3/4 fs over the usual /data partition.

then type:

cd /

mount /dev/block/mmcblk0p2 /sd-ext

----------------------------------

If you want swap (here 64MB) type:

dd if=/dev/zero of=/sd-ext/swap bs=1048576 count=64

/system/busybox/mkswap /sd-ext/swap

I have experienced a few lags and/or force closes due to swap. YMMV

----------------------------------

dd if=/dev/zero of=/sd-ext/ext2 bs=1048576

This may take a while, depending on the size of your patition.

/system/xbin/busybox mke2fs -F -L userdata /sd-ext/ext2

If you prefer journaling, use EXT4, EXT3 is slower.

With ext3/4 you'll get journaling, so it'll be safer. However that could add more wear to your SD.

With ext2, the file system is faster, less wear, but unsafe because the partition in not unmounted

nicely by the system. The partition could become corrupted after a while. I'm living on the	edge so I personally choose ext2 with a e2fsck on boot. Maybe ext4 later. If you want to run a

check manually, login with adb and run "e2fsck_recvy -p -v -f /mnt/asec/ext/ext2".

Edit: After a few reboots of my phone, no issues with EXT2. I run an e2fsck at boot time before mounting the ext2 file and the log always returned "clean" so far. This could be because android is unmounting /data and by doing so, unmounting nicely the ext2 partition.

Cyanogen Did a better job in his rom, with a nice unmount of the ext partition, but it means that

you have to flash his rom if you want this nice feature ;)

Now you should have 2 files in /sd-ext/, or 1 if you don't want swap.

5/ verbatim

type this:

mkdir /sd

/system/xbin/busybox mount -o loop /sd-ext/ext2 /sd

cd /data

cp -a * /sd

cd /

All you data should copied now.

check with a "ls -l /sd" that you have a least the directory structure.

"df" should report the space used on the new filesystem and should be close to your /data.

/system/xbin/busybox umount /sd

6/ Reboot

Reboot.

Move all you apps (if you have used the froyo AP2SD) back to the phone, which is now the SD.

Reboot to get a clean and stable phone :)

7/ Comments

You can also format your 2nd partition directly as ext2/3/4 and mount it over /data.

I tried myself but I experienced lower I/O that way, specially with small files.

Try and see what suits you better.

If you prefer the EXT2 partition, then you will have to change the 01data script to reflect that.

I hope that I didn't forget something. It's working for me so it should work for you! :D

Edit: If you want the BIG BOOST like here (http://xdaforums.com/showpost.php?p=9320253&postcount=17) then remove the "sync" option in the script below. You'll get more chance of spike lags, but what a boost!

For just giving it a try, type in adb shell window with android running:

busybox mount -o remount,noatime,nodiratime /mnt/asec/ext/ext2 /data

Then run quadrant... :D

Type again:

busybox mount -o remount,noatime,nodiratime,sync /mnt/asec/ext/ext2 /data

you will get file system sync back ON. Even like this, you should still have around 250% boost.