Jump to content

Welcome to CyanogenMod

Welcome to our forum. Like most online communities you must register to post, but don't worry this is a simple free process that requires minimal information for you to signup. Be a part of the CyanogenMod Forum by signing in or creating an account. You can even sign in with your Facebook or Twitter account.
  • Start new topics and reply to others
  • Subscribe to topics and forums to get automatic updates
  • Get your own profile and make new friends
  • Download files attached to the forum.
  • Customize your experience here
  • Share your CyanogenMod experience!

Enabling swap


202 replies to this topic

#1 marzib

  • Members
  • 18 posts
  • Twitter:marzib
  • Country:us
  • Device Model:Nexus One
  • MOD Version:7.0.3
  • Recovery Image:Amon_RA

Posted 12 July 2010 - 12:27 AM

How do you enable swap on CM6 for G1? Does a userinit.sh script work still? If that's the case, where does CM6 mount the ext partition? I don't see the sd-ext folder anymore...

#2 Firerat

  • Members
  • 1,800 posts
  • Twitter:firer4t
  • Country:uk
  • Device Model:Dream aka G1 aka trout
  • MOD Version:CM6 Magpie Ezt 2708
  • Recovery Image:ClockworkMod

Posted 12 July 2010 - 01:39 AM

View Postmarzib, on 12 July 2010 - 12:27 AM, said:

How do you enable swap on CM6 for G1? Does a userinit.sh script work still? If that's the case, where does CM6 mount the ext partition? I don't see the sd-ext folder anymore...
its easy to do

but don't, it makes cm6 crawl

#3 th2811

  • Members
  • 9 posts
  • Device Model:|2|
  • MOD Version:5.0.7
  • Recovery Image:Amon_RA

Posted 12 July 2010 - 08:56 AM

View PostFirerat, on 12 July 2010 - 01:39 AM, said:

its easy to do

but don't, it makes cm6 crawl

Can you say how to do it please?
Where i must place the code/userinitscript?
I would like to test it!

Thanks!

#4 Vilbrekin

  • Members
  • 9 posts
  • Country:fr
  • Device Model:|2|
  • MOD Version:6 RC1
  • Recovery Image:Amon_RA

Posted 12 July 2010 - 09:26 AM

It may crawl, but without swap CM6 (just as CM5) gives me an iphone...

I did it the quick and dirty way: patch /etc/init.d/20userinit, adding at the beginning:

mount -o remount,rw /
mkdir -p /sd-ext
mount /dev/block/mmcblk0p2 /sd-ext
mount -o remount,ro /

This re-activates my old userinit.sh activating the swap partition.
I don't understand why ext is not mounted by default in CM6. Maybe because they feal it's useless while ext app2sd is not finished...

#5 Firerat

  • Members
  • 1,800 posts
  • Twitter:firer4t
  • Country:uk
  • Device Model:Dream aka G1 aka trout
  • MOD Version:CM6 Magpie Ezt 2708
  • Recovery Image:ClockworkMod

Posted 12 July 2010 - 09:58 AM

http://forum.xda-dev...ad.php?t=679572

sh /sdcard/fr-patch133.txt swap

but I don't advise it on CM6

#6 th2811

  • Members
  • 9 posts
  • Device Model:|2|
  • MOD Version:5.0.7
  • Recovery Image:Amon_RA

Posted 12 July 2010 - 01:54 PM

Made a Script "83swapon" and pushed it into /system/etc/init.d/

83swapon:
swapon /dev/block/mmcblk0p3;
sysctl -w vm.swappiness=60;

Doesn't start on boot!?

Anyone know why?

#7 Firerat

  • Members
  • 1,800 posts
  • Twitter:firer4t
  • Country:uk
  • Device Model:Dream aka G1 aka trout
  • MOD Version:CM6 Magpie Ezt 2708
  • Recovery Image:ClockworkMod

Posted 12 July 2010 - 02:30 PM

View Postth2811, on 12 July 2010 - 01:54 PM, said:

Made a Script "83swapon" and pushed it into /system/etc/init.d/

83swapon:
swapon /dev/block/mmcblk0p3;
sysctl -w vm.swappiness=60;

Doesn't start on boot!?

Anyone know why?

I'm guessing you didn't make it executable

adb shell chmod 700 /system/etc/init.d/83swapon

will do the trick

#8 th2811

  • Members
  • 9 posts
  • Device Model:|2|
  • MOD Version:5.0.7
  • Recovery Image:Amon_RA

Posted 12 July 2010 - 02:41 PM

View PostFirerat, on 12 July 2010 - 02:30 PM, said:

I'm guessing you didn't make it executable

adb shell chmod 700 /system/etc/init.d/83swapon

will do the trick


THANK YOU VERY MUCH :)

EDIT:

:(

Swap was running on first boot but after second reboot: swap 0

When I type
swapon /dev/block/mmcblk0p3;
sysctl -w vm.swappiness=60;
into terminal (after system is startet) swap is active, but not automatic on boot?

Permissions are right

also testet to put the line "echo 255 >/sys/class/leds/blue/brightness;" into the 83swapon-file and led is lighting but swap not active

#9 Vilbrekin

  • Members
  • 9 posts
  • Country:fr
  • Device Model:|2|
  • MOD Version:6 RC1
  • Recovery Image:Amon_RA

Posted 12 July 2010 - 03:22 PM

I guess we have similar issues: it seems the SD card takes some time to get detected at boot time.

Quote

--------- beginning of /dev/log/main
I/cm ( 65): Welcome to Android 2.2 / CyanogenMod-6.0.0-DS-RC1
I/cm ( 66): _
I/cm ( 67): __ __ _ ___ _ _ __ ___ __ _ _ _ _ __ __))
I/cm ( 68): ((_ \(/'((_( ((\( ((_)((_( (('((\( ((`1( ((_)((_(
I/cm ( 69): )) _))
I/cm ( 70):
I//system/xbin/run-parts( 60): mount: mounting /dev/block/mmcblk0p2 on /sd-ext failed: No such file or directory
I/DEBUG ( 91): debuggerd: Jul 10 2010 23:59:19
D/AKMD ( 98): akmd 1.6.6 START
D/AKMD ( 98): library version: 1.2.1.1129
--------- beginning of /dev/log/system
I/Vold ( 89): Vold 2.1 (the revenge) firing up
I/Netd ( 90): Netd 1.0 starting
D/Vold ( 89): Volume sdcard state changing -1 (Initializing) -> 0 (No-Media)
D/Vold ( 89): Volume sdcard state changing 0 (No-Media) -> 2 (Pending)
D/Vold ( 89): Volume sdcard state changing 2 (Pending) -> 1 (Idle-Unmounted)


#10 th2811

  • Members
  • 9 posts
  • Device Model:|2|
  • MOD Version:5.0.7
  • Recovery Image:Amon_RA

Posted 12 July 2010 - 03:37 PM

View PostVilbrekin, on 12 July 2010 - 03:22 PM, said:

I guess we have similar issues: it seems the SD card takes some time to get detected at boot time.

yes I also think this is the problem - any way to change this?
(i.e. executing the script later)

#11 Firerat

  • Members
  • 1,800 posts
  • Twitter:firer4t
  • Country:uk
  • Device Model:Dream aka G1 aka trout
  • MOD Version:CM6 Magpie Ezt 2708
  • Recovery Image:ClockworkMod

Posted 12 July 2010 - 03:43 PM

View PostVilbrekin, on 12 July 2010 - 03:22 PM, said:

I guess we have similar issues: it seems the SD card takes some time to get detected at boot time.


View Postth2811, on 12 July 2010 - 03:37 PM, said:

yes I also think this is the problem - any way to change this?
(i.e. executing the script later)


you are already running the script 'late'

add a shabang

#!/system/bin/sh


#12 -Stevo-

  • Members
  • 1,297 posts
  • LocationSalt Lake City, Utah
  • Country:us
  • Device Model:HTC Vision G2
  • MOD Version:CM7.0.0-RCX
  • Recovery Image:ClockworkMod

Posted 12 July 2010 - 03:50 PM

Psycho13oy told me in IRC in different words to basically not expect a fix for this.

So basically that 20userinit script in init.d is absolutely useless as the ext part can't be mounted at boot for some reason.

#13 Vilbrekin

  • Members
  • 9 posts
  • Country:fr
  • Device Model:|2|
  • MOD Version:6 RC1
  • Recovery Image:Amon_RA

Posted 12 July 2010 - 04:43 PM

Well, a simple retry loop with smal delay should do the trick, giving enough time to initialize the SD card reader.

#14 BobSilva

  • Donators
  • 19 posts
  • LocationVancouver, WA
  • Country:us
  • Device Model:Nexus One
  • MOD Version:CM 7.0.0 RC2
  • Recovery Image:ClockworkMod

Posted 12 July 2010 - 05:10 PM

Firerat,

With all due respect -- and I respect the heck out of you -- I must disagree. I have an MT3G and swap is the only thing that makes life worth living (OK, not really :)). But, it significantly improves performance from the moment I enable it. I've run it in 5.0.8 and now in 6.0.0. The market app particularly sucks without it. So, I think it's affect on system performance really depends on the hardware platform. As always, your actual mileage may vary...

Thanks,
Bob

#15 Vilbrekin

  • Members
  • 9 posts
  • Country:fr
  • Device Model:|2|
  • MOD Version:6 RC1
  • Recovery Image:Amon_RA

Posted 12 July 2010 - 07:56 PM

FYI, I've tried with the following script, which seems to do the trick:

if [ ! -d /sd-ext ]; then
  mount -o remount,rw /
  mkdir -p /sd-ext
  mount -o remount,ro /
fi
PART=/dev/block/mmcblk0p2
for i in 1 2 3 4 5; do
  if [ -e $PART ]; then
    mount $PART /sd-ext
    break
  else
    echo "$PART does not exist (yet); sleeping a bit..."
    sleep 2
  fi
done


#16 Brantyr

  • Members
  • 39 posts
  • Country:au
  • Device Model:Galaxy S, Magic
  • MOD Version:6.0.0-RC1
  • Recovery Image:Amon_RA

Posted 12 July 2010 - 08:27 PM

Swap is still very necessary on my 32B I find, without it the launcher has to do a complete reload every time you've gone into an app more complicated than settings which gets very very tiresome. A minimal amount of swap (24-32mb) makes the phone so much more responsive it's not funny. Essentially I go from
Home key > wait 5 seconds > hit apps button > wait 2 seconds > scroll and select app
to
Home key > wait 1-2 seconds > hit apps button > scroll and select app

The difference in usability is night and day.

Edit: I should add I use 3 homescreens and fairly minimal widgets, all I have is power control, calwidget, facebook and music.

#17 jetracer

  • Members
  • 7 posts
  • Device Model:|2|
  • MOD Version:5/0/8
  • Recovery Image:Cyanogen

Posted 13 July 2010 - 12:23 AM

i use the swapper app from market.. takes care of everything.. i get lazy.

#18 vassago

  • Members
  • 20 posts
  • Twitter:thatcherrw
  • Country:us
  • Device Model:|2|0|
  • MOD Version:6.0.0
  • Recovery Image:Cyanogen

Posted 13 July 2010 - 03:07 AM

I gotta agree with Firerat here. I turned my swap on today just to check and it was miserable. I thought the swap was super cool and necessary, until on 5.0.8 my phone was running like crap, so I turned swap off and the phone was manageable again. Though, my sd card is only class 4, the decrease in performance and loading I saw today was so bad I doubt the class of the sd card had a whole lot to do with it. I have my swappiness set at 30 and a 64mb swap partition.

#19 -Stevo-

  • Members
  • 1,297 posts
  • LocationSalt Lake City, Utah
  • Country:us
  • Device Model:HTC Vision G2
  • MOD Version:CM7.0.0-RCX
  • Recovery Image:ClockworkMod

Posted 13 July 2010 - 03:09 AM

Gotta disagree, phone doesn't multitask, adw doesn't stay in memory, browser doesn't persist state, after swap on swappiness 40 32mb swap, everything runs perfectly.

#20 nwordjim

  • Members
  • 267 posts
  • LocationOregon
  • Country:us
  • Device Model:Tmobile G1 & G2
  • MOD Version:CM 7 Nightly 58
  • Recovery Image:ClockworkMod

Posted 13 July 2010 - 04:13 AM

Firerat would you mind explaining why Swap is bad for CM6? I am considering turning it on so my g1 would quit having to load the launcher everytime I leave it. and I currently have a 128mb swap that I made a while ago. should I use that or make another one of smaller size like a 32 or 64. Thx