[HTC Sensation] hinxnz:
MultiSwap - easy setup

I thought I'd post this for some people that aren't sure how to set up swap as mentioned earlier, this is a way how it can be done in basically two simple steps and will be reactivated after a reboot.

Setup for swap using 3 partitions:

This is for the use of 3 swap files as it seems popular and more ideal if you like this method, also with the same priority.

For this method to be done, terminal emulator has to have SU privileges, just open terminal and type su, hit enter and grant permission. You also have to have the space available on all 3 partitions (system,data,cache), to check the free space enter this code in terminal:

df /system /data /cache

- First download and extract the script attached below and place it in your SD card (root, not in any folder).

- Second enter the code below (copy & paste) into Terminal Emulator, wait till the process has finished (It could take a minute). Done :good:

99MultiSwap

su
mount -o remount,rw /system /data /cache
cp /sdcard/99MultiSwap /system/etc/init.d/99MultiSwap
chown 0.2000 /system/etc/init.d/99MultiSwap
chmod 755 /system/etc/init.d/99MultiSwap
mkdir /system/swap
dd if=/dev/zero of=/system/swap/swap.img bs=1048576 count=100
chown 0.1000 /system/swap/swap.img
chmod 666 /system/swap/swap.img
mkswap /system/swap/swap.img
mkdir /data/swap
dd if=/dev/zero of=/data/swap/swap.img bs=1048576 count=100
chown 0.1000 /data/swap/swap.img
chmod 666 /data/swap/swap.img
mkswap /data/swap/swap.img
mkdir /cache/swap
dd if=/dev/zero of=/cache/swap/swap.img bs=1048576 count=100
chown 0.1000 /cache/swap/swap.img
chmod 666 /cache/swap/swap.img
mkswap /cache/swap/swap.img
swapon /system/swap/swap.img -p 0
swapon /data/swap/swap.img -p 0
swapon /cache/swap/swap.img -p 0

Setup for swap using 2 partitions:

This is same method as above but for the use of 2 swap files, as requested.

For this method to be done, terminal emulator has to have SU privileges, just open terminal and type su, hit enter and grant permission. You also have to have the space available on the 2 partitions (data,cache), to check the free space enter this code in terminal:

df /data /cache

- First download and extract the script attached below and place it in your SD card (root, not in any folder).

- Second enter the code below (copy & paste) into Terminal Emulator, wait till the process has finished (It could take a minute). Done :good:

99MultiSwap

su
mount -o remount,rw /system /data /cache
cp /sdcard/99MultiSwap /system/etc/init.d/99MultiSwap
chown 0.2000 /system/etc/init.d/99MultiSwap
chmod 755 /system/etc/init.d/99MultiSwap
mkdir /data/swap
dd if=/dev/zero of=/data/swap/swap.img bs=1048576 count=100
chown 0.1000 /data/swap/swap.img
chmod 666 /data/swap/swap.img
mkswap /data/swap/swap.img
mkdir /cache/swap
dd if=/dev/zero of=/cache/swap/swap.img bs=1048576 count=100
chown 0.1000 /cache/swap/swap.img
chmod 666 /cache/swap/swap.img
mkswap /cache/swap/swap.img
swapon /data/swap/swap.img -p 0
swapon /cache/swap/swap.img -p 0

Please note: This complete post is just a reference for users, as this is regarded by some users of ROM off-topic. Feel free to experiment, change sizes etc. on your own accord. I do not take responsibility for you losing sensitive data etc. If in doubt create a Nandroid backup in recovery before doing so. Happy swapping :)

Removal: If you decide you want to remove swap used from this post, just enter the correct code below for the swap method you choose into terminal and wait till process is finished (takes about a minute). Done :good:

Using 3 Partitions:

su
swapoff /system/swap/swap.img
swapoff /data/swap/swap.img
swapoff /cache/swap/swap.img
rm /system/etc/init.d/99MultiSwap
rm /system/swap/swap.img
rm /data/swap/swap.img
rm /cache/swap/swap.img

Using 2 Partitions:

su
swapoff /data/swap/swap.img
swapoff /cache/swap/swap.img
rm /system/etc/init.d/99MultiSwap
rm /data/swap/swap.img
rm /cache/swap/swap.img

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

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

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

Edit: See my signature for my new MultiSwap :cool:

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

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

-----------------------------------------------------------------------------------------------​

.