[Script] swapconf - swap config

Search This thread

impactor

Senior Member
Jan 6, 2011
906
136
Kraków
Then it might be the problem with the recovery you're using (4ext?, htc desire?).
I guess the file was not installed. You could try to manually extract the file from update.zip/system/bin to /system/bin (or /data/local/bin), set permissions to 755 ("chmod 755 /system/bin/swapconf") to see if it helps.

Funny thing is that the file is already there. But I still get "not found". I put the unpacked file there anyway, but it's the same thing.
I tried regular terminal emulator, i tried Terminal IDM.
And yes, I am using "su".
 

mrvek

Senior Member
Feb 10, 2011
579
460
/home
Funny thing is that the file is already there. But I still get "not found". I put the unpacked file there anyway, but it's the same thing.
I tried regular terminal emulator, i tried Terminal IDM.
And yes, I am using "su".

On what device are you trying this? htc desire?
What do you get when you execute "which bash" in terminal.
I'm afraid that this script is not compatible with miui. I've tested it only on CM7 and CM10 for Motorola Milestone. If it a missing shell then it might work with sh. Unfortunately, there is no easy way for me to test on other devices but Milestone 1.
 

impactor

Senior Member
Jan 6, 2011
906
136
Kraków
On what device are you trying this? htc desire?
What do you get when you execute "which bash" in terminal.
I'm afraid that this script is not compatible with miui. I've tested it only on CM7 and CM10 for Motorola Milestone. If it a missing shell then it might work with sh. Unfortunately, there is no easy way for me to test on other devices but Milestone 1.

Yes, it's HTC Desire with MIUI XJ XPART.
which bash returns:
/data/data/com.spartacusrex.spartacuside/files/system/bin/bash

If it's not possible to use it, what alternative do you propose for unabling my 200mb size swap partition?
 

mrvek

Senior Member
Feb 10, 2011
579
460
/home
There is a line on top of swapconf script: #!/system/xbin/bash -> Change it to #!/system/bin/sh (you can find the exact location of your sh by running "which sh")

If it does not help make your own script that starts swap, e.g. swapon /path/to/swap_partition

I should probably change to sh in next version.
 
Last edited:

Erovia

Senior Member
Sep 16, 2012
818
262
Maybe the best option would be if always the default shell executes the script.
 

impactor

Senior Member
Jan 6, 2011
906
136
Kraków
There is a line on top of swapconf script: #!/system/xbin/bash -> Change it to #!/system/bin/sh (you can find the exact location of your sh by running "which sh")
That worked. I can now run swapconf, but I get an error while trying swapconf start p:
Code:
/dev/block/mmcblk0p1: unknown operand
whoami: unknown uid 0
root: unknown operand
cat: can't open /proc/swapsL No such file or directory
/dev/block/loop1: unknown operand
Could not find swap partition. Have you created it?
 

adamz667

Senior Member
Jan 15, 2011
659
669
Warsaw
Hello everybody,

Did you hear about DataSwap?
http://xdaforums.com/showthread.php?t=1805843

It creates swap file under /data partition (flash memory, which is faster than sd-card), so it should offer better performance. I know that this mod for Desire Z, which has lot more memory for /data, but in combo with sd-ext partition for apps it could works fine on Milestone. Think about it.

Cheers.
 

Eiertschik

Senior Member
Mar 28, 2011
399
67
Google Nexus 4
Google Nexus 5
-FuFu- modified his script to use /cache partition (script can be found somewhere in CM7 thread).

He also benchmarked his internal memory vs. a class 10 card.
The only thing that's faster with internal memory is random r/w, and we're not sure if that helps when swapping contiguous memory blocks.
 

impactor

Senior Member
Jan 6, 2011
906
136
Kraków
I'll try to find that post, but the problem with cache partition is that it is small and SWAP is likely to take it's entire size. What that means is that it will always occupy the same physical blocks of the internal memory and will wear them down sooner.

The DataSwap by kbeezie does that on /data partition, which is much larger and thus avoids this issue.
 

-FuFu-

Senior Member
my latest script is this ;) http://xdaforums.com/showpost.php?p=33957192&postcount=8502

to use swap on /data just edit 3 things:
1. line 5 - SWAPSIZE=32 to the size you want to use for swap but you must use value in kb like 10240 for 10mb
2. line 7 to SWAPDEV=/data
3. line 34 to dd if=/dev/zero of=$SWAPDEV/swap.img bs=1024 count=$SWAPSIZE >> $SWAPLOG

thats it, also create a blank file on /data with the name ".swapint" as i say in my original post...
 
Last edited:

impactor

Senior Member
Jan 6, 2011
906
136
Kraków
FuFu, thanks for the instructions. However, I followed them and I still get the same issue:
- OS runs but every app that starts produces a Force Close error
- when I connect to the phone with ADB, command "free" still says I am not using any swap

Associated questions:
1. If we use /data partition, what should we do about "LEAVE=10240" which is /cache-specific?
2. touch /data/.swapint - can I do that from within 4ext recovery just after flashing the zip? Do I need to mount /data partition before that (I did)?
 

impactor

Senior Member
Jan 6, 2011
906
136
Kraków
Code:
# cat swapon.log

use mmcblk0p3 for swap...
Setting up swapspace version 1, size = 208662528 bytes
set swappiness settings...
all done
It's a strange size since I set it to 64mb only... Wait, why is it using swap partition on the SD card anyway?
 

-FuFu-

Senior Member
looks like it dont find /data/.swapint
and the size is so big cause when mmcblk0p3 exist it will use the whole size...

just for test use the attached script

i dont realy know much aboz the Desire HD, and how to get it work there, but maybe it will word, the attached script will use 64mb on /data if it works...

if it dont work, try it by using a Terminal Emulator on device
commands:
su
dd if=/dev/zero of=/data/swap.img bs=1024 count=655360
mkswap /data/swap.img
losetup /dev/block/loop11 /data/swap.img
swapon /dev/block/loop11

if the DHD use /data as internal storage? or is it mount to another patch? to find out just tpye in Terminalemulator:
su
mount
 

Attachments

  • 98swapon.zip
    758 bytes · Views: 33

impactor

Senior Member
Jan 6, 2011
906
136
Kraków
Fufu, it is not Desire HD. It is Desire. I am using custom hboot with
system: 210mb (67mb free)
data: 222.6mb (175.6 free, which is strange cause it used to be ~199mb last time I checked. Maybe the swap file was created there already)
cache: 5mb (4.2mb free)

I am also using MIUI XJ X-PART rom which has built-in xpartition mod but I am not sure what is it moving to sd-ext

Code:
# mount
rootfs on / type rootfs (ro,relatime)
tmpfs on /dev type tmpfs (rw,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /mnt/asec type tmpfs (rw,relatime,mode=755,gid=1000)
tmpfs on /mnt/obb type tmpfs (rw,relatime,mode=755,gid=1000)
/dev/block/mtdblock3 on /system type yaffs2 (ro,relatime)
/dev/block/mtdblock4 on /cache type yaffs2 (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /mnt/asec/mtddata type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mmcblk0p2 on /data type ext4 (rw,nosuid,nodev,noatime,nodiratime,commit=15,barrier=1,stripe=64,data=ordered,noauto_da_alloc)
/dev/block/mtdblock5 on /data/local type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mmcblk0p3 on /data/data type ext4 (rw,nosuid,nodev,noatime,nodiratime,commit=15,barrier=1,stripe=64,data=ordered,noauto_da_alloc)
/dev/block/mtdblock5 on /data/property type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/misc type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/system type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.providers.contacts type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.providers.media type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.providers.settings type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.providers.downloads type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.providers.subscribedfeeds type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.providers.calendar type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.providers.telephony type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.providers.userdictionary type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.providers.downloads.ui type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.providers.applications type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.providers.telocation type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.providers.drm type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.google.android.location type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.voicedialer type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.defcontainer type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.launcher type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.contacts type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.phone type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.calculator2 type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/net.cactii.flash2 type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.miui.player type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.htmlviewer type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.bluetooth type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.calendar type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.browser type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.miui.backup type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.miui.antispam type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.miui.cloudservice type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.miui.notes type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.mms type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/cmupdaterapp.ui type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.certinstaller type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.miui.uac type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.miui.wallpaper type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.thememanager type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.miui.supermarket type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.updater type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.settings type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.fileexplorer type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.miui.providers.userbook type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.wallpaper.livepicker type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.packageinstaller type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.svox.pico type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.email type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.monitor type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.miui.fmradio type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.server.vpn type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.soundrecorder type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.vending.updater type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.inputmethod.latin type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.google.android.partnersetup type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.miui.camera type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.miui.bugreport type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.google.android.talk type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.stk type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.sidekick type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/android.tts type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.google.android.syncadapters.calendar type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.gallery type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.miui.control.panel type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.systemui type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.deskclock type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.android.spare_parts type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.google.android.gsf type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.google.android.syncadapters.contacts type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/com.google.android.backup type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mmcblk0p2 on /sd-ext type ext4 (rw,nosuid,nodev,noatime,nodiratime,commit=15,barrier=1,stripe=64,data=ordered,noauto_da_alloc)
/dev/block/mtdblock5 on /cache/download type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /data/data/misc type yaffs (rw,nosuid,nodev,relatime)
/dev/block/vold/179:1 on /mnt/sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0602,dmask=0602,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/block/vold/179:1 on /mnt/secure/asec type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0602,dmask=0602,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /mnt/sdcard/.android_secure type tmpfs (ro,relatime,size=0k,mode=000)


Will your new script ignore the existing swap partition on sd card?
 

-FuFu-

Senior Member
the script i attached here ignores mmcblk0p3 (with is used on milestone as swap)...
in the mount you see thats mmcblk0p3 is used for /data/data i thinks its cause of your custom hboot how i sayed i dont realy know how to get it work on desire

but mmcblk0 is the sdcard and mtdblock5 may be data

so the script must be edit that it creates the swap file on mtdblock5 if it creates on mmcblk0p2 you can also use the original script


but maybe some one in desire forum may can help you to get it work, i dont have a desire to test, just 2 milestones ;)
 

impactor

Senior Member
Jan 6, 2011
906
136
Kraków
Hey, Fufu. That's ok, I can do the tests for you.


1. Here's the result of the latest script:
- apps no longer force-close upon boot
- command "free" still says there is no swap
- swap file size 275MB (taking all available free space) has been created on "userdata" (this is how my linux system mounts it when USB storage is enabled) partition causing warning of "no space left on the device"


2. Here's the result of running the commands manually (no zip):
Code:
# su
# dd if=/dev/zero of=/data/swap.img bs=1024 count=[COLOR="Red"]655360[/COLOR]
/data/swap.img: write error: No space left on device
249725+0 records in
249724+0 records out
255717376 bytes transferred in 19.858 secs (12877297 bytes/sec)
# rm /data/swap.img
# dd if=/dev/zero of=/data/swap.img bs=1024 count=[COLOR="Red"][U]65536[/U][/COLOR]
65536+0 records in
65536+0 records out
67108864 bytes transferred in 2.900 secs (23140987 bytes/sec)
# mkswap /data/swap.img
Setting up swapspace version 1, size = 67104768 bytes
#  losetup /dev/block/loop11 /data/swap.img
losetup: /dev/block/loop11: No such file or directory

So I think that:
- 655360 = 640 MB, not 64MB
- /data/ is in fact mounted on on sdcard. How do I do it no internatl?
- I have no loop11. In /dev/block/ I have those:
Code:
dm-0       loop1      loop4      loop7      mmcblk0p2  mtdblock2  mtdblock5
dm-1       loop2      loop5      mmcblk0    mtdblock0  mtdblock3  platform
loop0      loop3      loop6      mmcblk0p1  mtdblock1  mtdblock4  vold

So based on the list of mountpoints from my previous post I conclude the correct commands should be (correct me if I'm wrong):
dd if=/dev/zero of=/mnt/asec/mtddata/swap.img bs=1024 count=65536
mkswap /mnt/asec/mtddata/swap.img


but then I get stock on which loop to choose.

PS
mmc* mount points are always on sd card


EDIT:

So, I got it down to this
su
dd if=/dev/zero of=/mnt/asec/mtddata/swap.img bs=1024 count=65536
mkswap /mnt/asec/mtddata/swap.img
losetup /dev/block/loop7 /mnt/asec/mtddata/swap.img
swapon /dev/block/loop7


and it seems to be working!
Code:
# free
             total         used         free       shared      buffers
Mem:        415632       411628         4004            0         3688
-/+ buffers:             407940         7692
Swap:        65532            0        65532

Can you look through it and see if all is as it should be?


So, I changed the zip script to look like that:
Code:
#!/system/bin/sh

## change to the size you want
## default setting is 32 for 32mb
SWAPSIZE=65536
## settings for use swap on intern memory
SWAPDEV=/mnt/asec/mtddata/
## how much space left for the swap device to use
LEAVE=10240

SWAPLOG="/cache/swapon.log"
SWAPLOGLAST="/cache/swapon_last.log"
if [ -f $SWAPLOG ]; then
	if [ -f $SWAPLOGLAST ]; then
		rm -f $SWAPLOGLAST
		mv $SWAPLOG $SWAPLOGLAST
	else
		mv $SWAPLOG $SWAPLOGLAST
	fi
fi
rm -f /cache/swapon
touch $SWAPLOG
echo "" > $SWAPLOG

rm /cache/swap.img
rm /mnt/asec/mtddata/swap.img

echo "use $SWAPDEV for swap" >> $SWAPLOG
FREE=`df $SWAPDEV | tail -1 | awk '{ print $4 }'`
echo "$FREE kb free on $SWAPDEV" >> $SWAPLOG
#SWAP=`expr $FREE - $LEAVE`
#echo "use $SWAP kb for swap" >> $SWAPLOG
dd if=/dev/zero of=$SWAPDEV/swap.img bs=1024 count=$SWAPSIZE >> $SWAPLOG
mkswap $SWAPDEV/swap.img >> $SWAPLOG
losetup /dev/block/loop7 $SWAPDEV/swap.img >> $SWAPLOG
swapon /dev/block/loop7 >> $SWAPLOG
touch /cache/swapon
	
if [ -f /cache/swapon ]; then
	echo "set swappiness settings..." >> $SWAPLOG
	echo "25" > /proc/sys/vm/swappiness
	echo "80" > /proc/sys/vm/dirty_ratio
	echo "30" > /proc/sys/vm/dirty_background_ratio
	echo "20" > /proc/sys/vm/vfs_cache_pressure
	echo "500" > /proc/sys/vm/dirty_expire_centisecs
	echo "1500" > /proc/sys/vm/dirty_writeback_centisecs
	echo "5" > /proc/sys/vm/laptop_mode
	echo "1" > /proc/sys/vm/oom_kill_allocating_task
	echo "0" > /proc/sys/vm/panic_on_oom
	rm -f /cache/swapon
	echo "all done" >> $SWAPLOG
fi
echo "" >> $SWAPLOG

and it DOES work! Can you just tell me if loop7 device is right for the swap?

And which of those values are related to swap on internal data performance?
echo "80" > /proc/sys/vm/dirty_ratio
echo "30" > /proc/sys/vm/dirty_background_ratio
echo "20" > /proc/sys/vm/vfs_cache_pressure
echo "500" > /proc/sys/vm/dirty_expire_centisecs
echo "1500" > /proc/sys/vm/dirty_writeback_centisecs
echo "5" > /proc/sys/vm/laptop_mode
echo "1" > /proc/sys/vm/oom_kill_allocating_task
echo "0" > /proc/sys/vm/panic_on_oom
 
Last edited:

impactor

Senior Member
Jan 6, 2011
906
136
Kraków
All is working fine now, as per my edited post. Thanks! Can you just tell me if there is any difference between loop devices, and answer my question about the vm values at the end of my last post?
 

-FuFu-

Senior Member
i think you can just take every loop device, i dont realy know much about this ;)
i also take parts of the scrip from other scripts that i found with google ;)

and with the vm values you must play around, there some differents betwen devices, for me my values works fine on milestone, if you use google you may find some other values and also the discription
 

Top Liked Posts

  • There are no posts matching your filters.
  • 25
    Description:
    A small command line tool to create, delete, enable or disable swap file on sdcard and autostart swap file or partition on boot (zRam (compcache) is configured through system Settings))


    Features:
    - Automatic detection of partitions and files: if you do not have a dedicated swap partition, script uses swapping to file - first on sd-ext and if that one does not exist then it swaps to sdcard. Swap partition takes precedence over files. This should work no matter if you have or do not have ext partition (for app2ext) on sd card.

    - create and delete swap file - you can test different sizes without rebooting

    - ability to start and stop swapping where ever it may be configured: biggest advantage of this is that you can stop swap if you have it on your /sdcard so you can use mass storage mode. Also, you can test various sizes for swap files or how your system works when swap is disabled, without need for a reboot

    - misc. activities: view status of swap partition/files and status of memory

    Usage:
    Code:
    Disable startup:    swapconf 0 -> disables startup script
    Enable startup:     swapconf 1 -> enables startup script
    Create swap file:   swapconf mkf size_in_MB -> creates swap file of specified size (e.g. swapconf mkf 30  for 30MB swap file)
    Remove swap file:   swapconf rmf -> removes previously created swap file
    Start swap:         swapconf start p|f -> starts swapping to partition (p) or file (f)
    Stop swap:          swapconf stop -> stops swapping whereever it may be started
    View swap status:   swapconf status -> view status of swaps and memory
    		
    NOTE: Enabling both swapping to partition and to file is not supported.
    If you have a dedicated swap partition on sdcard it will be used if enabled. Otherwise you need to configure swap file.

    The attachment is OpenRecovery flashable update zip. Simply apply update.
    Startup script should persist across new ROM updates until you do a factory reset (wipe data)

    Feedback is welcome ;)

    Changes for version 0.2:
    - relocated script from /data/local/bin to /system/bin: if your terminal app does not export /data/local/bin to PATH that should not be an issue anymore. Script should still persist across ROM updates [thanks to kabaldan for the tips :)], startup script should persist until you do a factory reset (or you delete/disable it ;)).
    - reworked script commands: previously you were not able to create swap file without enabling startup script
    - improved partitions detection
    - fixed a bug where you could not stop swapping to file if zRam was active
    - mics. fixes and cleanups

    Changes for version 0.2b:
    - fixed backup of swapconf script during ROM upgrade on CM10

    Notes:
    - script will not persist when changing different ROM versions, e.g. from CM7 to CM10
    - kabaldan and Skrilax_CZ have informed me that it is a bad idea to have active swap on sdcard's FAT32 partition unless there is an app that will disable swapping when the sd card is going to be mounted to PC. So far, the only issue I have noticed is that you can not mount USB mass storage mode until you turn off swap so I left that possibility enabled. The choice is yours (btw., it uses fat32 partition only if you have no dedicated swap partition or ext partition).
    5
    If the green LED is kept turned on, device stuck, it has nothing to do with any user space scripts that are scheduled to be executed later during boot.
    There are some 2ndboot issues to be solved yet...
    Until the green LED is turned off, no script could be executed - the green indicates that the current boot is still somewhere between the 2ndboot bootloader and the 2ndboot kernel running, init still not started yet...
    2
    with this script you can config your settings by using the terminal

    my script only aktivate swap and creates a swapfile (if needed), to config my script you must edit the script itself
    2
    Do you have /data/local/bin in your PATH? Or you always navigate to /data/local/bin?

    Try this:
    echo $PATH

    To see if /data/local/bin exists in your path, if not then:

    export PATH= $PATH:/data/local/bin

    after that you wont need "sh" or "./" before swapconf (and you will be able to execute swapconf cmd from everywhere)...

    Remember that this is not permanent PATH export, you need to do that everytime, as mrvek guided me, in terminal's settings there is an option to execute some commands on console startup (similar to .bash_profile) and you should put there "export PATH= $PATH:/data/local/bin" so you don't have to do that every time on console startup.

    Sent from my Milestone using xda app-developers app
    1
    Thanks a lot for the info. :)