[Galaxy S II Q&A, Help & Troubleshooting] mmahmoodh:
I found this in android stack, couldn't post the link..

reboot your phone into Download mode (Volume DOWN + Home + Power) and connect your phone to the computer. Let Windows install the drivers. If it fails, try to install Samsung Kies or just the drivers provided in the bundle I made available, and try again.

Open Odin3 as Administrator and connect the phone. It should detect your phone and show it under the label ID:COM, and also in the Message. If it didn't, try to restart your computer, phone, reinstall drivers, check your USB cable, etc., and try again.

Now you'll need to choose a PIT file. PIT means Partition Information Table and it is a Samsung-only thing. In the bundle file, I made available ElGamal's PIT file (I91001GB_6GB.pit) which also resizes /system partition to 1GB, /data to 6GB and the rest goes to internal storage. If you wish different sizes, check the thread at XDA-Developers as he made many different versions available. I also included a PIT file for the default configuration (I9100_2GB-STOCK.pit) if you wish to go back to as it was later.

When you have chosen your PIT file, go to Odin and tick the following checkboxes: Re-Partition, Auto Reboot and F. Reset Time. In the Re-Partition section, click on the PIT button and select your chosen PIT file. In the Files (Download) section, click on the AP button and select Samsung's stock JellyBean ROM. Double check everything and click Start. This can take a while, go grab a coffee.

After everything finishes, your phone will reboot into the stock Samsung JellyBean ROM. Two things can happen now, or it will work normally and if so you can use it and check if everything is as you want. Or it can ask you for a password to access the "encrypted volume", which is nothing but your internal storage that is not formatted. In both ways, unplug your phone (it it's still plugged) and reboot it into Download mode again.

It is interesting to close and reopen Odin3 to reset the settings. Plug your phone again and wait until Odin3 detects it. This time, leave checked just Auto Reboot and F. Reset Time and make sure Re-Partition is NOT checked. Click on AP button and select the ClockWorkMod Recovery .tar file, then click Start. This one is faster, but if you feel sleepy, go for another coffee ;)

When it finishes, you should have ClockWorkMod Recovery 6 installed in your phone, so go ahead and reboot into Recovery mode. Go to mounts and storage, select format /storage/sdcard0 and format it as exfat (if for some reason you have write problems in your internal storage later, come back here and select another format until it works, but exfat should do the trick).

When it finishes, still in Recovery mode, Wipe data/factory reset, Wipe cache and Wipe Dalvik cache. Let's be sure nothing remains from the previous ROMs.

Now, install zip -> choose zip from /storage/sdcard1 and select the CyanogenMod 11 .zip file (or of your desired ROM) and flash it. Optionally also flash GApps afterwards. Reboot your phone and check if everything is right.

If everything is right, reboot your phone into Recovery mode again, do a new wipe data/factory reset, wipe cache and wipe Dalvik cache, and then recover your backed up ROM from the beginning. Reboot your phone.

Hope it helps

Regards