![]() |
[DISCUSS] SDCard Swap Partition Methods..
This is relevant to Easy Debian and general faster operation of maemo, so I thought this needed a separate thread in order to discuss the best methods..
I have been reading about using SDCard partition for swap in the Easy Debian Thread - http://talk.maemo.org/showthread.php?t=34550&page=271 Based of what I have seen, there are some tweaks by freemangordon and Estel tweaking overall swap settings I'd like to make permanent. I'd also like to apply the SDCard swap during startup What is the best method for this? Is it better to create a startup script in /etc/event.d, or is there an existing file to modify? If so - how do you apply the changes? Is striping swap across sdcard and emmc the best method, or is single swap on sdcard the better way to go? |
Re: [DISCUSS] SDCard Swap Partition Methods..
Single swap on SD card is definitely better way to go, as it don't create I/O conflicts between Maemo /home/ and swap. It's even better than stripping swap between eMMc and SD card - speed benefits are quite a myth, as conflicts eat any benefit + add overhead (flash media doesn't handle many independent request very efficiently).
As for method of setting it permanently - script in /etc/event.d isn't bad thing - especially, that in case of problems, there are methods (haven't tried myself) to delay executing such scripts. Ho ever, it makes boot slower, as - technically - Maemo first enable eMMC swap, then, due to our script, enable SD swap and disable eMMC swap. It's unnecessary operation. So, best way, if You're absolutely sure that it's what You want, is to edit /etc/event.d/rcS-late, replacing line: Code:
swapon -a Code:
swapon /dev/mmcblk1p2 This way, swap on microSD is enabled during boot process without any additional overhead, and eMMC swap partition isn't used at all. You may reclaim it's space by repartitioning, or keep it as backup solution (I keep 100 MB backup swap on eMMC for purpose of "refreshing" swap partition, which I'll elaborate more later). As for swap settings mentioned in thread linked in 1st post, [b]freemangordon[/]'s ones are surely more bleeding-edge - mine are more similar to stock settings, yet I'm very satisfied with results (I'm trying to find balance between freemangordon's ones and stock ones, and it seems to be that). Most of things set there can be edited by swappolube, although, not all of them. Remember, that setting them via echo modify it only until next reboot - to set it permanently, one should add it to some script in /etc/event.d/ (setting it here is much faster than enabling&disabling swap, so difference in booting time shouldn't be noticed), or do ti exactly as swappolube does it (how?). That's the basics. Very important thing is preventing swap fragmentation via swap reflesh - I've modified shadowjk's scripts to make it bulletproof solution, and liked to publish it long time ago - well, IU hoped for doing it convenient way via a repos, but publishing here for pre-audit may be a good idea. I'll post it and elaborate more about it on later time. /Estel |
Re: [DISCUSS] SDCard Swap Partition Methods..
That would be a good option to add to Swappolluble so you can enable/disable swap on any existing partition from the UI.
|
Re: [DISCUSS] SDCard Swap Partition Methods..
It should be noted that if you do put swap on SD that you can under no circumstance take the back cover off when the swap is mounted on the SD. When you do this the MMC is insta-umounted with respect to no man.
To remove the back cover without moving swap back to emmc is like pulling a RAM chip from a running PC but worse. I have destroyed entire SD cards and completely corrupted my emmc beyond backup menus help by doing this. It believe it is entirely possible to create a 'swapon SD/swapoff SD' entry in power menu 'systemui.xml' just by adding a few lines just like phone/tablet mode button thing. |
Re: [DISCUSS] SDCard Swap Partition Methods..
About this: does someone know if this is done on the hardware side, or by the kernel (would be patchable) ?
And also what is the point of such behaviour: if at least the microsd was propely unmounted, that would be understandable, but that's not the case if I remember correctly. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Agree with vi_, + there is simple workaround, allowing to both have swap on microSD *and* ability to remove backcover - glue small magnet on place, where sensor expect it. It doesn't require *any* hardware skills, and works great. I'm using it for ages.
Of course, if You do so, never ever take out Your SD card without unmounting it (=also set swap somewhere else, at least temporal), but if You're messing with such settings as proposed in this thread, You know it already. /Estel |
Re: [DISCUSS] SDCard Swap Partition Methods..
Estel, I would be interested in your defragmentation script ;) Also, swappolube creates a file in event.d called tuning, in case you didn't found out already ;)
Are the proposed settings really the best? I found swapiness to 50 work better when receiving calls than set 30 rest I use proposed and a part of your settings found in ED thread. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
A better solution would be to replace swapon -a with the 'swapmicro' script posted somewhere here on TMO, which detects swap partitions on the microsd, and if it is available, uses that and doesnt bother with emmc. Otherwise, if there's no swap on microsd, it simply runs swapon -a. I'll post my edits to rcS-late when I get back home. |
Re: [DISCUSS] SDCard Swap Partition Methods..
is it possible we can get more ram from 256 physical ram. I only get 46 percent available. I hav a galaxy s i9000 and i previously used to get 256 out of 512 by trying differnet kernel. Then i got 409.
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
And editing critical system files may bail out a few noob's N900 ;) I do use a different approach: put a script in event.d, that checks for existence of my swap file (yes, I do use a swap file on standard vFAT SD partition (too lazy for repartitioning)), could also check for existence of partition. then enable the swap as loopback device with higher priority (using bb power's swapon or also possible debians swapon). This way at startup eMMC swap is used, around 4-5MB, and then swap only on SD. If you want to cleanup swap, just 'swapoff mmc' and it uses eMMC swap. If I want to use again swap on SD, just enable it with higher priority 'swapon mmc -p 0'. This assures also that swap is available even no or another SD is available. As my script is highly customized to my needs ( starting python maps server, mounting maps in a loopback file, checking for other stuff) I am not going to post it here (in its current state) ... I am not sure that using loopback as swap is faster (better) than using eMMC swap, but as there are no tools yet to confirm, it is just subjective opinion. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Maybe I've overlooked information and/or threads on here, but a couple of weeks back I did a reflash and decided on spending max. 2 hours on running the swap on the microSD. Bottomline, I couldn't find a helpful guide and/or tools to achieve this so I gave up. If the result of this thread would be a comprehensive guide, working for most users, I would be really glad!
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
@peterleinchen As I've written, way of doing ti via /etc/event.d/ script isn't bad at all, but it got one drawback - boot time is considerably slower, as Maemo need to enable eMMC swap first, then, via Your script, enable microSd swap, and disable eMMC swap. As - at this point - some thing are already swapped (most likely, You run event.d scripts after starting hildon-desktop), they need to be moved from eMMC swpa to microSD swap. As for using microSD swap together with eMMC swap, I don't recommend it, even with higher priority for microSD swap - it's still "in use", which creates (less, but still), I/O rade with things from optFS. Also, I'm quite sure, that using loopback file for swap is considerably slower than native swap - as it's with ED loopback image or native partition. @BertvanDorp 5 minutes guide to using swap on microSD: 1. Reformat microSD card to contain linux type swap partition, by any tool You prefer (linuxbox/linux LiveCD via GUI tools, or on-device via command line, or on-device via Easy Debian with GUI tools, or...). For this example, we assume You got 2 partitions on microSd card - first one is regular vfat, and 2nd one is linuxswap. 2. Use any method mentione din this thread to make device into using swap on /dev/mmcblk1p2 (you can edit /etc/event.d/rcS-late as suggested by me, or prepare script put into /etc/event.d folder, or wait for Hurrian to post his script and mix it with my way, or...). You're done. /Estel |
Re: [DISCUSS] SDCard Swap Partition Methods..
how to increase available ram? cant we get atleast 200 from 256?
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Dafuq? I don't think you understand what RAM is, what RAM is for or indeed how it is utilised under linux. |
Re: [DISCUSS] SDCard Swap Partition Methods..
listen. I know that u have knowledge on these bt android also has a linux base kernel. Flashing differnet kernel increases the available RAM. I have a galaxy s. When i first bought it it had 356md RAM free out of 486. Then i rooted my device. Flashed some custom ROM and kernel. And installed some tweaks. Now i get 412 available which obviously makes my device faster.
|
Re: [DISCUSS] SDCard Swap Partition Methods..
No. It doesn't. Really, just trust me on that (tm). And see this:
http://en.wikipedia.org/wiki/Random-access_memory http://ffhacktics.com/smf/index.php?...ach=5741;image |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Code:
cmp -s $tmp_fstab $fstab || cp $tmp_fstab $fstab |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Unfortunately, N900 and Maemo5 as it runs on N900 simply can not function without swap. N900 really should have 512MB minimum to run smoothly, but that SoC configuration was not available to Nokia at the time N900 design was finalized, from what I've read. Different kernels may affect RAM availability as a result of different compiled-in options or optimizations. On N900 virtually everything that is nonessential is compiled as a module, meaning it does not get loaded unless it actually gets used. Unused modules don't use any RAM. There are recent discussions on LKML about optimizing swap for flash media, batching writes to align to erase-blocks, etc. which would greatly speed it up (similar, for example, to Btrfs in SSD mode). But this doesn't exist in our old kernel and may never exist for us if it's something that can't be backported easily. |
Re: [DISCUSS] SDCard Swap Partition Methods..
but isnt it possible to make N900 run more faster. the speedpatch doesnt work. its nothin but crap. freezes the phone a lot. overclocking is one way but it doesnt do me any good. my phone is overclocked to 850 running ideal profile but still it freezes for example if a phone call comes when i am browsing. its terrible. my freinds laf at me. where the are using galaxy s and even people using milestone. seriously, there are many times that i even missed a call twice or thrice. what shud i do?
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Quote:
This seems to me as the best trial for newbies. I checked sources and its nicely done. Only the compcache I am worried about. Followed the zram thing, but it stopped somehow. I do not know the latest status, so I would like to ask anybody about feedback (otherwise I would propose to disable that?). Quote:
I think it is a nice way to do and it helps to move I/O load away from eMMC. I think about merging my approach (using of swap file also possible) with the swapset script (starting it earlier, this is started on hildon-desktop) ... |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
2. Get a dumbphone, sorry 'android'. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
Just yesterday my phone was ringing but the screen didn't turn on or respond until it was too late. N900 is great as a pocket computer, but pretty bad as a telephone because of that kind of thing... in my opinion. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
http://talk.maemo.org/showthread.php?t=80095 This is going to require some experience with the n900. Please don't post any questions about the script in this thread. This device is quite amazing, but you need to invest time to learn to manipulate it, so i suggest you start investigating yourself a little more. Good luck. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
/Estel |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Sure thing. Just read this thread from the beginning, the apply settings that suit You best.
If You fail to understand what was said here, gain basic linux knowledge (or general computer knowledge) - no offense here - and try again. /Estel |
Re: [DISCUSS] SDCard Swap Partition Methods..
just this thread? these 3pages. i read it. but dint get nythn from it :(
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Then, fallback to plan B, as everything You need to know was here (in fact, even in few first posts, another ones are just to make it easier for end-user).
Quote:
/Estel |
Re: [DISCUSS] SDCard Swap Partition Methods..
i saw the posts, the links to use sd card as swap. but cant use it. dunno. would have been easier for me and most noobs like me if u could tell me a step by step guide. bt yes, i cant even expect this much from you. you are a senior member of this forum. surely u will get annoyed because these are simple things for you. bt still. taking a chance to make my N900 fast,responsive.
|
Re: [DISCUSS] SDCard Swap Partition Methods..
i saw the posts, the links to use sd card as swap. but cant use it. dunno. would have been easier for me and most noobs like me if u could tell me a step by step guide. bt yes, i cant even expect this much from you. you are a senior member of this forum. surely u will get annoyed because these are simple things for you. bt still. taking a chance to make my N900 fast,responsive.
|
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
By writing such step by step guide to every issue, the community will make a much slower progress. time wasted about documentation needs to be limited, since it hurts progress with open and new issues that are found all the time. I don't see myself at a high level with mameo, but still i am willing to learn and i have spent many hours to fill gaps of things i did not understand. I think you are trying to jump to deep water without the will to learn to swim from your own reasons and that is fine, but with that being the case, i think that this device might not be the best choice for you. By starting to learn from the bottom, asking questions that will prove that you are learning and evolving, i believe you will find people in these forums much more helpful - as i have found, so understand that the responses you get are not coming from a bad place. |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
I agree with others that it's plain unwise to write guides and let noobs alter settings they shouldn't alter. But on the other hand you have to realize: these 'n00b' people here that still ask these questions are the ones trying not to give up on their N900, the rest has moved on.
So, I think it's also a good approach to gather best-practice methods into comprehensible guides and/or packages, that allow the 'regular user' to have a great Maemo experience as well. For example, the script by Impehan looks really promising, and would help me, and a lot of others out, but I'm simply not able to implement this right now. Converting this into a package ('app' in regular-user words) would involve no risk for the regular user, and help out, right? Now, back to the Swap-to-microSD thing: am I right that an 'easy' approach would be to create a file on the micro-SD and use swapset or just swapon to enable the file? The steps would be: 1. create file, name ... 2. use 'swapon ...' to test 3. run [thing] to disable unmounting on removing cover 4. do [thing] to include both measures in bootloop 5. [...] 6. profit! 7. some incredible hero converts this into an app, and gets donations, thanks, and so on Right? Now, can someone help me fill in the blanks? :D |
Re: [DISCUSS] SDCard Swap Partition Methods..
Quote:
I also often read that if you connect a N900 with an sd card to a PC in PC suite mode the card gets unmounted from the N900 and mounted by the PC. But if I connect my N900 to one of my PC's (all of them running Debian, no idea if that matters) the ext2 partition remains mounted on the N900 and I can mount it from the PC. I can then read data simultaneously but writing from either side without manually unmounting the other side in advance results in FS corruption. Anyone? Quote:
|
Re: [DISCUSS] SDCard Swap Partition Methods..
I am worried about the instant reboots I experience when enabling ramzswap. Happens sometimes, not always, but in a startup script?
Then the easiest solution for newbies is package swapset. Even nobody will check sources ("dpkg -x *.deb ."), but just install ... @Bert Quote:
(except this does not work for swap files, just partitions) |
Re: [DISCUSS] SDCard Swap Partition Methods..
@Estel and others
How do you refresh your swap? I made a script which checks the amount of written bytes on mmcblk1p1 (not swap usage) and think that swap defragmentation occurs only after 768MB written. Is that right? Or should I rely on amount of /proc/swap ? But I almost never go over 256MB here. Or when does swap fragmentation do start? |
All times are GMT. The time now is 01:12. |
vBulletin® Version 3.8.8