Editing Swap on microSD
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
- | + | =Swap= | |
[[:wikipedia:Paging|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 [[Open development/Maemo roadmap/Fremantle|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). | [[:wikipedia:Paging|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 [[Open development/Maemo roadmap/Fremantle|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). | ||
Line 5: | Line 5: | ||
Enabling additional swap is not needed on the [[Nokia N900|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. | Enabling additional swap is not needed on the [[Nokia N900|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 kernel parameter which tells it how aggresive should the swapping be. 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. [[Open development/Maemo roadmap/Diablo|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 [[root access|run as root]]. | ||
echo 30 > /proc/sys/vm/swappiness | echo 30 > /proc/sys/vm/swappiness | ||
- | You can set swappiness at each boot automatically by using | + | You can set swappiness at each boot automatically by using [[startup script]]. |
- | |||
- | + | =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. | |
- | |||
- | + | * /dev/mmcblk0 (internal eMMC itself) | |
- | + | * /dev/mmcblk0p1 (27 GB partition mounted on /home/user/MyDocs) | |
- | + | * /dev/mmcblk0p2 (2 GB partition mounted on /home) | |
+ | * /dev/mmcblk0p3 (768 MB swap partition on eMMC) | ||
+ | * /dev/mmcblk1 (microSD itself) | ||
+ | * /dev/mmcblk1p1 (fat32 partition on your microSD mounted on /media/mmc1) | ||
+ | * /dev/mmcblk1p2 (swap partition on your microSD) | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
# '''mmc''' part defines type of storage device | # '''mmc''' part defines type of storage device | ||
Line 74: | Line 40: | ||
# '''p'''Y defines partition number | # '''p'''Y defines partition number | ||
- | The swap partitions are not | + | |
+ | The swap partitions are not mounted, but you can enable swapping on microSD partition with: | ||
swapon /dev/mmcblk1p2 | swapon /dev/mmcblk1p2 | ||
Line 81: | Line 48: | ||
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. | 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. | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
[[Category:Power users]] | [[Category:Power users]] | ||
- |
Learn more about Contributing to the wiki.