![]() |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Thanks Whitewolf that looks alot safer. What do you get for the swap priorities when you cat /proc/swaps ?
As I am personally going to stick to running a script manually after a reboot, and following Whitewolfs lead using sfdisk, I have added the lines below to my tuning script to ensure the uSD swap is available before making any changes. Code:
testmicro="/dev/mmcblk1p2" I have tested this by running with no SD card, and it works; if mmcblk1p2 is not present it will make no swap changes. I'd like to be able to get this added to the wiki page, as the current instructions only sets up the faster swap as secondary- and it will never get used considering the huge default primary swap. As I've said I'm kinda new to all this so I wouldn't dream of doing so unless somebody with some experience had a look at the above code and gave me some feedback. Does it look safe enough to add to the wiki? |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Cat /proc/swaps
/dev/mmcblk0p3 Priorit=-1 /dev/mmcblk1p3 Priorit=-2 |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
I like but I see a limitation because you say what the swap.
I watch as it automatically adapt to the example that I put myself and not depend on the human well. How to place her at the start to run? |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Here's a startup script I made (goes in /etc/events.d/) based on elipsoid's script to check for the microSD swap file before changing the swap configuration. I broke some of the commands into two lines because depending on how you partitioned your MicroSD, you might get un-suppressable warning messages from sfdisk that would mess up the process.
Code:
start on started hildon-desktop |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
With the code as you wrote it I do not ever ride swap the SD.
I would remove the following line: Code:
testmicro = "/ dev/mmcblk1p2" Code:
swapmicro = $ (echo "$ drivelist"-n | grep / dev/mmcblk1p2 | awk '/ mmcblk1p2 / {print $ 1}') Code:
drivelist = $ (sfdisk -ln /dev/mmcblk1 | grep swap) Then modify the following lines ... Code:
if [ "$ testmicro" == "$ swapmicro" ]; then Code:
if [ $ swapmicro ]; then |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
My script worked fine but I'm going to incorporate your improvements into my earlier post (with one little change to deal with sfdisk's warning messages)
|
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
I look forward to this script! Good idea.
.. If I can help, I will love it. |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Good stuff guys, this is looking very polished and robust - certanly a smarter way of doing things and nice and compact.
Gameboy, the -q switch for sfdisk surpresses warning messages, I've just tried it and it works. |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
I tested with the amendment proposed and returns nothing if there are error messages by sfdisk.
I confirm that the "-q" sfdisk output prevents error messages. |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
|
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Actually I tried the -q and it didn't work for me (Gives a long warning about paritition table cylinders), but it couldn't hurt to add it to the script, will do.
|
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Sorry your right the -q does nothing (warnings scrolled past top of screen on N900, was doing things remotely till now).
What does work is if you use the switch for msdos mode, -d, it returns a similar list except that now now the linux swap is listed as Id=82, so we can use this instead. Code:
start on started hildon-desktop /dev/mmcblk1p2 I have also changed the awk part, so that instead of looking for the specific swap partition /mmcblk1p2/, it looks for the more general swap on /mmcblk1/. I think this is what Whitewolf was suggesting in case people have their cards partitioned differently. I think thats it now - ready to go? :) EDIT: I have tested this now by adding to /etc/event.d/ and it works as expected. On reboot with no card present no swap changes are made. With swap on SD present it enables swap with the faster memory having a higher priority. If you are going to do this I'd suggest putting it in file on its own - or if you are adding this to an existing tuning script, put it at the end as it will exit when no external swap is detected. (Many thanks GameboyRMH and Whitewolf, this noob has learned a lot working on this with you) |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Great stuff.. Might do this later on when I'm ready. :)
Thanks |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
I love, has been very clean script.
I will try. |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Finally I think what we need for N900 is a 512 Mb RAM chip behind a SD controler with microSD format.
For swap only, there is no need of persistence as it remains on voltage. Question: what is the best way to benchmark N900 and collect perf stats, specifically about swap usage ? |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
I set up a 768 MB swap partition on p3 of my class 6 MicroSD using gparted on my laptop.
I set up two Queen BeeCON widgets: Widget one: Command Name: MicroSD Swap On Command: sudo swapon /dev/mmcblk1p3 && sudo swapoff /dev/mmcblk0p3 Widget two: Command Name: MicroSD Swap On Command: sudo swapon /dev/mmcblk0p3 && sudo swapoff /dev/mmcblk1p3 I seem to get much better easydebian performance with this (I also installed easy debian to a 6GB ext3 partition to increase performance and app space). It's nice to be able to switch it off, If I want to remove the microsd for whatever reason. I've noticed performance gains using optified programs as well as in easy debian, presumably due to having swap on a seperate disk. It takes a while for swapoff to run. To monitor progress, I watch it in conky. Once the total swap size gets back down to 768, it's done. I'm sure there's a much better way to do this, but this was very easy and convenient. This is somewhat unsafe, as it doesn't check to make sure mmcblk1p3 is actually present. If mmcblk1p3 is not present, and you have more memory used in swap than you have free RAM, it will be ugly. |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Hello!
I'm not too familiar with Linux yet but I'd like to try to enlarge the capacity of swap memory and learn more. I have read couple Threads here about this issue and I just like to know which of these solutions posted here are the latest and safest? So if someone could reply here or send me a private message which contains the necessary commands in a compressed form. Or is the wiki for that already telling it in that way (so there isn't something else I should do or know) Thank you :) |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
The easiest and safest solution is to first put this script in /etc/event.d:
Code:
start on started hildon-desktop And that's it. Totally safe and easy. |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Welcome Misferatu.
As gameboy says above it's as simple as correctly formating your SD and running that script at startup (which it will do automatically when you save it to /etc/event.d ) . I'd say 384mb is a good bet, as I personally haven't ever seen the swap spill over that, the default 786mb swap the n900 originally came with is massive overkill - and remember that original swap will still be available if you do manage to fill the swap you created on the SD card. |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
hii frnds .
i want to ask that if we overclock our device to 1Ghz. then will it give better performance with the swapable virtual memory? |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
A 1GHz overclock would give a bigger overall performance boost than running the primary swap from a Class 6 MicroSD, but both modifications at the same time would be best.
|
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
I can confirm that this mod can tune-up the device. In fact it must be a great imrpovement because when doing filesharing eMMC s***s. I think it has to do with 2 interfaces. And about speed increase one cannot expect a wonder an increase in 6% - 30% is not bad compared to a shareholde value of an enterprise or other badly coded programs here. BTW. I have some tune-up utilities in my signature.
|
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
osomee is we need high class memory card like class 6 or class 2 is sufficent
|
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
I was looking around for a sandisk extreme and couldnt find one in microSD format, so I grabbed a 4gb Patriot class 10, and put it through a sandra benchmark:
Code:
|
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
113 kbyte/s... Best I've seen so far...
|
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Swap
Swap is a virtual memory which runs off storage devices (HDD, SSD, eMMC, microSD...). It is in a form of a file on a drive (currently this method does not work on Maemo 5) or as a seperate partition (this is actually a better method). Its advantages are that it expands available memory, but it is of course very slow compared to thousand times faster RAM and is therefore used by the system to drop off data which is currently not needed. That means that you can run many programs at once, but they will be running slowly. Virtually every desktop OS does that (for example Windows has page file). Enabling additional swap is not needed on the N900 for expanding available memory, because it has already 256 MB of RAM and 768 MB of swap space on internal 32 GB eMMC module, resulting in 1 GB of total available memory, which is enough for a device like that. It does however help to offload the work from internal eMMC if there is additional swap space enabled on microSD, because kernel uses both swap partitions and is therefore swapping bandwidth increased which results in higher performance. Swappiness Swappiness is a kernel parameter which tells it how aggressively to swap. The more aggressive it is, more RAM is freed, but there is a performance impact, because more data needs to be swapped (written to the slower drive). Swappiness value is between 0 and 100 with 100 being the least aggressive. Maemo 4 had swappiness set to 1 by default while Maemo 5 sets it to 100. The best value is somewhere in between. 256 MB of N900's RAM is enough for a few open programs and there is also enhanced battery life because eMMC doesn't need to write so much swap data. So swappiness should be set somewhere between 30 and 50. It is set with the following command which has to be run as root. Code:
echo 30 > /proc/sys/vm/swappiness (EDIT by egoshin): In case of N900 you should check that with lower swappiness values you still have an acceptable time of answering calls by phone application. With lower swappiness your N900 more likely meet the situation then there is no enough memory to load phone application for incoming calls - kernel needs to swap-out some applications and you may miss a call. Maximum swap-out speed is around 18 MBytes/sec into eMMC. With maximum swappiness the kernel just discards the memory pages of some applications because it is already in swap space and cut a time. I believe it is a reason why Nokia set 100 by default for swappiness. (EDIT by eero): The situation will also change after a while because swap becomes fragmented (parts of processes' memory are spread all over swap in little pieces). I.e. testing the speed only for few hours after boot isn't enough, new setting needs to be tested for several days. Configure microSD card for swapping The microSD card must be split into at least 2 partitions. The first one should be FAT32 (vfat) formatted and the second one must be formatted for linux swap (type 82) and about 384 MB in size. You can change the size of it, but this value should be suitable for most people. You can repartition and reformat the card with standard Linux tools from the N900 terminal, but the easiest way is to connect the device in mass storage mode to a Linux machine (which can also be a virtual machine if you use other OS as your primary one) and you can do the partitioning with GUI tools. Using microSD partition as swap Reboot after the repartitioning and after the boot, this is seen in /dev. Please Take Note On Below Explaination, This I don't Want You All Simply KeyIn Script Without Understanding What It Means by - mmcblk0 - mmcblk0p1 - mmcblk0p2 - mmcblk0p3 - mmcblk1 - mmcblk1p1 - mmcblk1p2 Quote:
Quote:
Code:
swapon /dev/mmcblk1p2 There is an additional warning and that is that while the device is running and swap is turned on on microSD partition, you shouldn't take the card out. It would be the same as taking out a RAM stick while running. Swap priorities In order to utilize both swap partitions to balance the I/O load (striping), they should have the same priority. The /bin/swapon command shipped with Maemo is the busybox version that does not support -p option. If you don't have Easy Debian environment installed, download the stock Debian mount package for the armel architecture and extract (-x) the swapon binary from it, and copy it somewhere e.g. /sbin/swapon.debian. It seems that it's not possible to use -p -1 to match the priority of the default eMMC swap partition. I use the following trick: Code:
1. activate the microSD swap: Code:
/home/user # cat /proc/swaps Code:
Filename Type Size Used Priority Depending on the performance of your microSD card, your N900 might now feel much faster when swapping takes place, about the same, or even slower - YMMV. My N900 definitely seems to have less those total I/O trashing episodes lasting 5-10 minutes, where you might think your N900 just died, after doing heavy I/O (e.g. download a 100 MB podcast with gPodder) after activating this dual-swap scheme. Note: In my testing my N900 crashed when I tried to fill the VFAT data partition on the microSD with something like dd from /dev/null to a file. It's propably best to dedicate the whole microSD card for swap, if possible. Credit To - Original Author Unknown |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
hi there....i've read this thread and i just cant get the microsd card to be a VR thing...
Care to help or just bring some light on this? |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
That was a very helpful post, and the last sentence concerns me. I was planning on getting a large micro SDHC card to split up into VFAT, ext4 (for Easy Debian), and swap partitions. Now I wonder if that would be a stable combination.
Quote:
|
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
I've got an 8 GB mSD card split into 3 partitions between swap, ext3 and FAT32, out of necessity. No problems.
Based off of these instructions: http://discussions.europe.nokia.com/.../751901#M17953 |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Hi there
Trying to set up 1gb MMC for swap, having an issue: sudo gainroot mkswap /dev/mmcblk1p1 swapon /dev/mmcblk1p1 first to steps are fine, get an 'invalid argument' on step 3. Any ideas? |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
I had similar problems at first. You have to umount /media/mmc1 and then dd if=/dev/zero of=/dev/mmcblk1p1 bs=1024 count=1048576 before mkswap to ensure there are no holes. Also, have you set up the partition table for the MMC card?
|
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Code:
sfdisk -l /dev/mmcblk0 | /bin/busybox awk \ |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Quote:
or can anybody zip it and put it here to download? |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Quote:
i used to stripe but now i am exclusive on mmc for swap. |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
hmm been trying different google and that.
can anybody point me to the site necessary or just upload the "swapon" & "swapoff" from the arm. |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
mount is not separated from shell, so should be part of busybox or bash. Did you try busybox-power? This is an enhanced busybox shell which offers the -p switch for swapon.
However, i did not not test, if it is working. |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
1 Attachment(s)
Quote:
no need for swapoff from this package. btw, thanks for giving the community awesome test for batteries. :) |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Quote:
|
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
hmm got some missing libs etc...
but tried the busybox-POWER!!!! hehe and that worked just fine :) |
Re: Using Micro SD Card as Virtual Ram on Nokia N900?
Quote:
apparently moving files from rootfs to emmc saves battery life. I am yet to confirm the same though :) |
All times are GMT. The time now is 08:13. |
vBulletin® Version 3.8.8