PDA

View Full Version : Bigger swap file for N770


Bundyo
2008-02-26, 13:05
I only tested this in OS2008HE, since it is in dire need of it :), but should be working in the other versions too. Of course i will not be held responsible if you send your device to hell. Didn't search the forums if this was posted before. :)

First create a swap file like you do it normally (from the Control Panel).

Then run a XTerm and do these commands:

swapoff /media/mmc1/.swap
dd if=/dev/zero of=/media/mmc1/.swap bs=1024 count=256000
mkswap /media/mmc1/.swap
swapon /media/mmc1/.swap

The second command is specifying the size of the swap, here it is close to 256MB, you can tweak it to your liking. This operation can also take very long time so be patient.

After restart it should remain the same size. It will reset probably if you mess again with the swap settings in Control Panel.

MikeL
2008-02-26, 13:50
I wanted to ask about this for the Nokia770 and your post has reminded me. What happens when we swap MMC between NIT's after tweaking swap settings via xterm. (Would they revert to the norms for each OS regardless or what exactly?)


I have a 64MB card provided with my Nokia 770 and 56Mb or thereabouts is permanently set to a swap file on this card.
I have a 1GB MMC card for the Nokia 770 that I installed in my N800 (OS2008) with the adapter and it has the max of 128Mb of memory set permanently to swap.
When I put the larger card into the Nokia 770 it still indicates a theoretical maximum of 64MB from the control panel, memory option. (i.e. up from 56 to 64MB but not beyond to 128MB)
I am using Canola2 on my Nokia 770 with OS2006 and wish to see if increasing swap size helps at all (As long as swap space on card is available) but am wary of causing problems for the OS etc.

How would I best utilize your script cautiously where I assume card must be ideally empty of swap or any other files when running these commands

dburr10085
2008-02-26, 14:06
Yes - I was looking at this for the N770 also - with 2007HE.

Bundyo
2008-02-26, 14:39
You can easy check if the swap resizes on the go by running an XTerm and run

free

Then swap the card and run free again. check if the swap sizes change. If they don't, that means the swap isn't remounted on the new card, try to restart and run free again.

When i have a 256MB swap, the control panel is saying 64MB, so that's not a reliable source :)

rachid
2008-02-26, 14:59
dd if=/dev/zero of=/media/mmc1/.swap bs=1024 count=256000
mkswap /media/mmc1/.swap
swapon /media/mmc1/.swap


I tried it and it is working. With
cat /proc/swaps
you can see how much swap is used.
thanks!

fpp
2008-02-26, 15:21
I only tested this in OS2008HE, since it is in dire need of it :), but should be working in the other versions too. Of course i will not be held responsible if you send your device to hell. Didn't search the forums if this was posted before. :)

It's probably been posted several times 2 years ago, but it's nice and handy to have it repeated here just when we've flashed OS2008HE :-)
Thanks !

dburr10085
2008-02-26, 16:08
I get "text file busy" on 2007HE.

MikeL
2008-02-26, 16:26
You can easy check if the swap resizes on the go by running an XTerm and run

free

Then swap the card and run free again. check if the swap sizes change. If they don't, that means the swap isn't remounted on the new card, try to restart and run free again.Thanks Bundyo I checked with command "free" and live swapping between the two cards.

Sure enough swap changed in size between 56MB (For 64MB MMC), 0GB (With NO MMC) and 64MB (With 1GB MMC) (64MB being theoretical max for OS006 without making any xterm command changes) even though the physical swap size on 1GB card is actually/currently 128MB. (seems OS2006 never sees full 128MB available even under xterm when using free command)

So if I am understanding correctly I can now use your suggested commands to temporarily increase the swap size even higher on my Nokia 770 or other NIT's for an ongoing booted session and the swap size should stay that way until I hard re-boot and/or I swap cards?

i.e. create a physical 256MB swap (Using first command) which will from then on always available on a particular MMC card and then set swap size of OS (i.e. Nokia 770 OS2006 & N800 OS2008) to be in alignment using the suggested commands and all running programs will then know the extra swap space is available for use if they need it?

Just trying to get my head around the overall concepts etc.

tvogel
2008-02-26, 16:43
First create a swap file like you do it normally (from the Control Panel).


I don't think you need to do that first. Rather, I'd suggest not to do it, because otherwise you are writing onto a file which is currently used as swap and this doesn't sound like a good idea. Even, I'd say: If you already have a swap space, please disable it first. Either in the control panel or with
swapoff /media/mmc1/.swap

Bundyo
2008-02-26, 19:56
Yes, i forgot that unfortunately. You shoud switch off the swap before creation. I even deleted the file...

About the creation first - i'm doing that to get automatic swap mount at boot. There are other ways but this one looks easier :)

@MikeL: I'm not sure 'cause i didn't try, but it sounds reasonable that the swap file gets remounted if you switch cards the same way as it is on reboot - i mean with its full size.

ericdkirk
2008-02-26, 22:27
Every time I enter

swapoff /media/mmc1/.swap

or
mkswap /media/mmc1/.swap
swapon /media/mmc1/.swap


I always get "command" : not found

do i need to be root to do this and which become root works on the 2008HE?

Bundyo
2008-02-26, 23:49
Yes, you should be root. Gronmayer lists the bora repo as the source of becomeroot. I used ssh.

here.david
2008-02-27, 01:27
while I have both the N770 and N800 working with the listed steps, the N810 does give the "not found" message...I did see a @mkswap (used MC) on the ./SBIN just no mkswap.

www.rzr.online.fr
2009-01-22, 00:11
Just curious why do you zerofill the partition before formating it ?

BTW, special thx to bundyo for his android kernel , I am promoting it :

http://www.newlc.com/en/nitdroid-demo-gnulinux-android-nokia-n770-0

XTC
2009-01-27, 20:50
As for swap size. I think that it's better to have one app closed unexpectedly (by OutOfMemoryKiller) than tablet rebooted via wd32 (watchdog).
Bigger swap on n770 - when system is trying to use all this memory on slow device like mmc - reboot is likely to happen.