maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   Using Micro SD Card as Virtual Ram on Nokia N900? (https://talk.maemo.org/showthread.php?t=42357)

locolyric 2010-09-19 05:03

Re: Using Micro SD Card as Virtual Ram on Nokia N900?
 
Quote:

Originally Posted by somekeystrokes (Post 819475)
the last line seems to give me an error saying invalid argument!
:(
what to do?
I have a 4gb card!

have you install nitdoird ?

i do install nitdroid last time and i face the same problem with you ,since there was a reply tell us that we should try "/mmcblk1p2"
instead of " mmcblk1p1"

and it work!!

kevinp93 2010-09-22 11:32

Re: Using Micro SD Card as Virtual Ram on Nokia N900?
 
Quote:

Originally Posted by rewt (Post 496825)
For those who need more VM, and wish to use their entire MicroSD card for this purpose:

(WARNING: This will erase the entire MicroSD card, or worse, some or all of your internal memory if you mistype the device name.. If you plan to proceed, I recommend that you have some idea what you are doing)

In x-term:

Code:

sudo gainroot
mkswap /dev/mmcblk1p1
swapon /dev/mmcblk1p1

The last line will have to be rerun each time your device is rebooted, unless you add an init script to run it.

Hello.

I have installed Nitdroid on my Micro-SD card, and Nitdroid has partitioned my Sd card and I have approx 2GB free. Can I use these 2GB as 'virtual ram'? Thanks

GameboyRMH 2010-09-24 15:29

Re: Using Micro SD Card as Virtual Ram on Nokia N900?
 
Hey, I got an idea, I thought I'd get a second opinion before trying it through.

To work around Maemo 5's swapon's inability to mount swap files with a specific priority, what if we copy Debian's swapon tool to /usr/sbin/debswapon, and change genfstab.awk to use that instead? Seems like it should work.

Edit: Did some experiments and the Debian swapon won't run on Maemo that easily.

frantic912 2010-10-12 09:10

Re: Using Micro SD Card as Virtual Ram on Nokia N900?
 
i just create startup script using this command :

Start on started hildon-desktop
stop on starting shutdown
console none
service

script
sleep 60
swapon /dev/mmcblk1p2
end script



and put it under /etc/init.d but still not working after reboot....
why???

elipsoid 2010-10-17 11:29

Re: Using Micro SD Card as Virtual Ram on Nokia N900?
 
OK, here is another way to enable both swap partitions, this way the faster microSD partition has the higher priority - only using the internal swap when it becomes full.

I've only started messing around with this Linux stuff, so if I'm wrong your comments are welcome. However it really seemed to have worked for me, I had setup a solitary swap of about 350MB and started to get sporadic low memory warnings (but conky did not show any problems), especially when using firefox with a bunch of other apps opened at the same time. After doing this I cannot recreate the memory warnings no matter how hard I try:cool:

Simply this:
Code:


      swapon /dev/mmcblk1p2
      swapoff /dev/mmcblk0p3
      swapon /dev/mmcblk0p3

Checking
Code:

cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/mmcblk0p3                          partition      786424  0      -2
/dev/mmcblk1p2                          partition      359868  476    -1

From the above you can see the swap on the microSD is higher priority than the one on the internal, and so should in theory be used consecutively when the partition on the removable card becomes full.

maxximuscool 2010-10-17 11:32

Re: Using Micro SD Card as Virtual Ram on Nokia N900?
 
i've read from YDL that using memory card flash memory as virtual swap Ram will reduce the life of the flash chip by a lot. So I guess it can be done but not the most efficient way to do it.

YDL = Yellow dog linux.
I was planned to use my memory card as SWAP on my PS3 back then.

elipsoid 2010-10-17 12:30

Re: Using Micro SD Card as Virtual Ram on Nokia N900?
 
Quote:

Originally Posted by maxximuscool (Post 843249)
using memory card flash memory as virtual swap Ram will reduce the life of the flash chip by a lot..

This is true, there are only a finite number of write cycles each memory block can achieve on a flash device. Modern solid state drives use special algorithms to minimise the amount of times each block is written to, extending the life of the device when used as a main computer drive (with swap).

I know that this would not be implemented on the n900's SD, and so placing the swap there will affect the life of the card. However the amount of write cycles has increased massively from what was achievable on early devices where this was a real issue, and we must remember that the default swap on the n900 is also on flash, albeit internal flash.

Actually that is an interesting point - by disabling the internal swap and moving it to the cheaply replaceable microSD, would you be extending the life of your N900?
(This is effectively what I have done, as it only uses the internal swap when the external one is full)

GameboyRMH 2010-10-18 13:10

Re: Using Micro SD Card as Virtual Ram on Nokia N900?
 
I've tried elipsoid's method of setting the MicroSD's swap file priority higher than the internal flash and it definitely is faster. Also it's better to wear out a replaceable microSD than the non-replaceable internal flash storage.

You can also add those swapoff/swapon commands to a startup script, I've done it and it doesn't seem to affect boot time at all.

elipsoid 2010-10-18 23:53

Re: Using Micro SD Card as Virtual Ram on Nokia N900?
 
I've personally not added my tuning and overclocking stuff to any startup script for fear of an endless reboot nightmare - that is just a personal thing, I know most people have no problems( I run a script from terminal -feels far more geeky:) )

Im not sure that these swapon / swapoffs would be fine at startup, as if the microSD is not functional it will return an error at the first step and preserve the onboard swap.

The second step disables the onboard swap though; and I have no idea what would happen if the device has no swap available before it re-enables it in the third step. I do know that the swap is either not used or used very little at all directly after a reebot (hence no difference to startup times as there is very little to copy, takes lot longer if the device has been in use for a while) so it may not matter.

I may have a look at my scrpits and have it check that the card is available before continuing, I'll post back here if I do.

WhiteWolf 2010-10-19 09:52

Re: Using Micro SD Card as Virtual Ram on Nokia N900?
 
Edit the file "/etc/event.d/rcS-late"

seeks the following:
Code:

  sfdisk -l /dev/mmcblk0 | /bin/busybox awk \
        -v home_opts="$home_opts" -v fat_opts="$fat_opts" \
    -f /usr/lib/genfstab.awk > $tmp_fstab

add below:
Code:

  sfdisk -l /dev/mmcblk1 | /bin/busybox awk \
        -f /usr/lib/genfstab2.awk >> $tmp_fstab

should look like:
Code:

  fstab=/etc/fstab
    tmp_fstab=/tmp/fstab

    sfdisk -l /dev/mmcblk0 | /bin/busybox awk \
        -v home_opts="$home_opts" -v fat_opts="$fat_opts" \
    -f /usr/lib/genfstab.awk > $tmp_fstab

    sfdisk -l /dev/mmcblk1 | /bin/busybox awk \
        -f /usr/lib/genfstab2.awk >> $tmp_fstab

    cmp -s $tmp_fstab $fstab || cp $tmp_fstab $fstab
    rm -f $tmp_fstab

save changes and exit.

Now copy the file genfstab.awk:
Code:

cp /usr/lib/genfstab.awk / usr/lib/lib/genfstab2.awk
Edit "/usr/lib/genfstab2.awk" and leave it like this:
Code:

#!/usr/bin/awk

BEGIN {
    # states so that we don't end up having more than one
    # of home or MyDocs; we can have as many swaps as we find
    __home = 0
    __fat = 0
}

/^\/dev\/mmc/ { start=1 }
start == 1 && $6 == 82 {
    printf "%s none swap sw 0 0\n", $1
}

the rest delete it.

Now you can restart, each time you start to check that the microSD has a swap partition and if so will mount.

I'm seeing a more elegant and does not need extra partition or cards.

The manipulation of system files can leave the N900 unusable.
I take responsibility for the results.
I really worked.


All times are GMT. The time now is 15:54.

vBulletin® Version 3.8.8