Increase RAM using Swap File and Swap Partition
NOTE:
I spent hours updating my guides and I don't ask you to press that THANKS button, be kind enough not to copy my guides to other forums. I know some noobs want to make a name on other forum boards... but hey, that's not an excuse!
Thread featured on XDA Portal
POSTED MAY 29, 2012 AT 4:00 AM BY POORCOLLEGEGUY
WARNING: This mod may degrade SD card life.
What you need:
MiniTool Partition Wizard for SD Card Partitioning
A MicroSD HC 4GB or higher class 6 or class 10
MicroSD HC Card Adapter
A card reader (if your pc doesn't have card reader built in | USB Mount is not adviseable)
Swapper2 from Google Play Store [DOWNLOAD]
ADB Shell or terminal Emulator (to check if swap is activated)
Make sure you have BusyBox installed
Before we start, lets do some reading . . .
RAM
What is RAM
Random Access Memory (RAM) is temporary data storage that the CPU uses during calculations. The more RAM a device has, the more calculated results the CPU can store - which means less time the CPU has to do the same thing over and over again. In other words, the CPU can check RAM to see if it has already made a particular calculation in the recent past. If it has, it can use the pre-computed results instead of wasting processing time recomputing the same calculation. In short, more RAM means a more efficient (and faster) device.
SWAP
What is SWAP
Swap is, in short, virtual RAM. With swap, a small portion of the hard drive is set aside and used like RAM. The computer will attempt to keep as much information as possible in RAM until the RAM is full. At that point, the computer will begin moving inactive blocks of memory (called pages) to the hard disk, freeing up RAM for active processes. If one of the pages on the hard disk needs to be accessed again, it will be moved back into RAM, and a different inactive page in RAM will be moved onto the hard disk ('swapped'). The trade off is disks and SD cards are considerably slower than physical RAM, so when something needs to be swapped, there is a noticeable performance hit.
Unlike traditional swap, Android's Memory Manager kills inactive processes to free up memory. Android signals to the process, then the process will usually write out a small bit of specific information about its state (for example, Google Maps may write out the map view coordinates; Browser might write the URL of the page being viewed) and then the process exits. When you next access that application, it is restarted: the application is loaded from storage, and retrieves the state information that it saved when it last closed. In some applications, this makes it seem as if the application never closed at all. This is not much different from traditional swap, except that Android apps are specially programed to write out very specific information, making Android's Memory Manager more efficient that swap.
Step by Step Guide
How to create Swap Partition
Using MiniTool Partition Wizard
Plug in you MicroSD HC Card to your computer using the card adapter. (Do not use USB Mount)
Open MiniTool Partition Wizard and look for the card
Right Click on it and select Delete Partition
Click on Apply to Delete the Partition
Right Click on it again and select Create Partition
Set the partitions as follows:
1st partition:
Label: Android-SD
Create as: Primary
File System: Fat32
Partition size: as much as you want!
2nd partition:
Label: Android-EXT3 (2nd partition is for EXT which you can use for A2SD or Link2SD)
Create as: Primary
File System: EXT3 (be it a custom kernel or ROM with EXT4 support, use EXT3 still -play safe! )
Partition size: MIN: 256 MB MAX: 1024MB (1GB)
3rd partition:
Label: (do not put anything)
Create as: Primary
File System: Linux Swap
Partition size: MIN: 32MB MAX: 1024MB(1GB) RECOMMENDED: 256MB
After creating partitions, click Apply to apply changes.
Using ClockWorkMod
Reboot to Recovery
Go to Advanced and Debugging
Select partition SD card and select the partition size that delights you
How to use Swap
For us to be able to use swap file or swap partition, we need to use Swapper2 which you can get from Google Play.
Download and Install Swapper2 (of course)
After installing, open Swapper2 and navigate to Menu > Settings
Swapper preferences: (for kernels that doesn't have swap partition support)
Run swapper at startup (put a check)
Swap place: /sd card/swapfile.swp (you can place it in a folder if you don't like a messy sd card structure )
Swap size: MIN: 10 MB MAX: 256MB RECOMMENDED: 32MB (choose any)
Swapiness: RECOMMENDED: 10MB SYSTEM DEFAULT: 60MB MAX: 100MB (choose any)
Safe unmount (put a check)
Safe remount (put a check)
Advanced preferences: (for Kernels that supports swap partition only)
Use swap partition (put a check)
Swap partition: /dev/block/mmcblk1p2
After setting preferences, press back and tap on "ON" to turn on swap. Reboot afterwards
How can I tell if swap is running?
Go to the terminal emulator - or open adb shell - and run 'free'.
If it looks like this (with zeros in the swap line), you do not have swap:
If it looks like this (with anything other than zeros in the swap line), you do have swap:
NOTE:
You need to turn off swap before you mount SD via USB, if you don't you will not be able to mount sd as swapfile is active and set to read only which will deny request to mount USB Storage.
Get Swapper2 here:
Thanks to kalhimeo who attached the the apk file on this POST or click this ATTACHMENT LINK to download.
Related
Hi,
I'm not a developer but I think my idea is great.
1. Using CACHE partition (80Mb) as virtual ram
- I see that we are using swap ext partition to increase virtual ram, but access data speed of sdcard is not fast enough (for class2 or class4 sdcard),
- And I see that we have 80Mb free in cache partition which are only used when we use OTA update. But if we use a moded rom, why do we use OTA update ? access data speed of internal memory is really good, why don't we use cache partition as virtual ram ???
2. Runing faster with dalvik-cache on internal memory.
- As you know, after install an application, we will have apk file in data/app or data/app-private and some odex file in dalvik-cache.
- If we only use app2sd with data/app and data/app-private, our application will run faster.
Is that even possible? if it is, its really a nice idea.
The only problem with this idea is that you'd be using NAND flash for your memory. NAND has a limited number of writes before it starts to degrade. You would be much better off using less expensive SD card storage for virtual memory (swap)
cursordroid said:
The only problem with this idea is that you'd be using NAND flash for your memory. NAND has a limited number of writes before it starts to degrade. You would be much better off using less expensive SD card storage for virtual memory (swap)
Click to expand...
Click to collapse
Translation: virtual memory would kill your onboard memory much faster than regularly, so it's better to use your SD card, which is cheaper / easier to replace.
At least that's what I got from it
Hi!
I've published on Android Market an application that create and manage swap file.
If you don't have a swap partition on SD card, this app is what you need!
You can:
* Set swap file position (FAT or EXT partition if exists)
* Set swap file dimension
* Enable/Disable swap on boot
In other words... you can resize swap on the fly and save your preferences without reformatting SD any time!
Now your GTalk Service, WaveSecure, any service/application that run in your device will still running without stop-restart cycle 'cause missing ram
search "swapper" on Market!
Only with root!
Changelog:
v.1.5
* Fix check free space with SD larger than 4Gb
v.1.4
* italian localization
* check for available free space
* added icon (Thanks Jester )
what if we have a swap partition, would it be able to use that like with swapper?
asb123 said:
what if we have a swap partition, would it be able to use that like with swapper?
Click to expand...
Click to collapse
if you have a swap partition, swapper add a swap file:
swap partition: 32Mb
swap file: 200Mb
output of "free" on "Terminal": 232Mb
The swap create and managed by Swapper can be configured and changed everytime you need to do.
released v.1.5
Doesen't work with Samsung i7500, always fails.
Tried internal sd and real sd for swapfile.
Liebhild said:
Doesen't work with Samsung i7500, always fails.
Tried internal sd and real sd for swapfile.
Click to expand...
Click to collapse
i7500 don't support "swapon" function, so my app don't work: it create swap file, but without "swapon" it can't enable it...
maybe galaxo rom that don't support "swapon".
When i reboot, and i open MemInfo, i don't see any swap file! I think that the swap file desactivate when rebooting! Samsung Galaxy Spica .
First of all,thanks for the app,but i have a bug:
On first time i runned it it worked normally,i set swap size and tiped "free" on terminal emulator,and there is the swap,but when i rebooted it gone,e checked the "activate on boot""!
azatoth said:
Hi!
I've published on Android Market an application that create and manage swap file.
If you don't have a swap partition on SD card, this app is what you need!
You can:
* Set swap file position (FAT or EXT partition if exists)
* Set swap file dimension
* Enable/Disable swap on boot
In other words... you can resize swap on the fly and save your preferences without reformatting SD any time!
Now your GTalk Service, WaveSecure, any service/application that run in your device will still running without stop-restart cycle 'cause missing ram
search "swapper" on Market!
Only with root!
Changelog:
v.1.5
* Fix check free space with SD larger than 4Gb
v.1.4
* italian localization
* check for available free space
* added icon (Thanks Jester )
Click to expand...
Click to collapse
it is not able to use either of my ext2 or swap partition on sd card..
i have link2sd and that is able to use ext2 but this app only lists ma fat partition for swap file,,
also does it makes difference if we use a fat or ext2 or swap partition for it?
i m using ideos u8150-b
Query about Galaxy SII
Does this app support Samsung Galaxy S2 I9100 running NeatRom?
What kernel does it need?
i use galaxys2 with cyanogen 12. i create 1024 mb of swap it is ok but only 256 mb of ram is generated. how can i solve this problem?
Every now and then .. many ppl are asking, how to use external_sd to store movies, big files, or big games cos of insufficient internal memory or simply not wanting to make use of internal phone memory.
This tutorial will help you to make use of your external_sd card as a secondary partition in your android device. Enabling you to move & link all your big applications, games including the huge data & cache to your external_sd. Perhaps, with the help of Link2sd app (after performing this operation), you might be able to directly install huge apps onto your ext_sd card.
Disclaimer
This information comes with no warranty! What you're going to do is completely at your own risk!
I shall not be held responsible for any damage to your hardware and/or device if you had chosen to follow the following steps. Cheers!!
Caution:
May degrade card's life.
Effect will be permanent
Tools Required:
A rooted android device
A windows operating computer
An external_sd card (8GB external_sd was used for this operation)
MiniTool Partition Wizard - Home Edition (Free) application
Link2sd app
Steps to follow:
Backup the ext_sd contents to computer to restore after the operation (ext_sd will be formatted during the operation).
Open up the "MiniTool Partition Wizard" aplication.
# if you're using Win7, then open as admin.
Select your new un-partitioned memory
- "create" partition
- give it a lable, then choose primary & fat32, size: 6.5gb
Select the other un-partitioned memory
- "create" partition again
- no lable required, choose primary & ext2, size: 600mb
# recommended at 600mb, more than this volume will be effecting card reading performance.
Select the other un-partitioned memory
- "create" partition again
- no lable required, choose primary & Linux Swap, size: 60mb
Close all un-ncessary applications and hit "Apply".
## it will take a while to process the changes
once completed, which was once an 8Gb will now be showing 6.5Gb (check its properties frm "my computer"), the remaining volume will be used by ext2 and Linux Swap
Restore all your backed up ext_sd files
Connect ext_sd card back to your device
Install Link2sd on yr device
Open up link2sd and select "ext2" as the second partition, and tap OK.
You'll be prompted to restart yr phone, please do so.
## Enjoy linking your unmovable apps and data to your external_sd.
Note: This tutorial was only performed once on a friend's device, galaxy mini, and it worked .. hopefully it works for you too.
Good Luck!!
This tutorial was translated from a YouTube video "Tutorial Link2SD Partition Manager Android Liquid Mini" by rumahchat
============================
Hit THANKS if this helped. :good:
Increase RAM using Swap File and Swap Partition
NOTE:
I spent hours updating my guides and I don't ask you to press that THANKS button, be kind enough not to copy my guides to other forums. I know some noobs want to make a name on other forum boards... but hey, that's not an excuse!
Thread featured on XDA Portal
POSTED MAY 29, 2012 AT 4:00 AM BY POORCOLLEGEGUY
WARNING: This mod may degrade SD card life.
What you need:
MiniTool Partition Wizard for SD Card Partitioning
A MicroSD HC 4GB or higher class 6 or class 10
MicroSD HC Card Adapter
A card reader (if your pc doesn't have card reader built in | USB Mount is not adviseable)
Swapper2 from Google Play Store [DOWNLOAD]
ADB Shell or terminal Emulator (to check if swap is activated)
Make sure you have BusyBox installed
Before we start, lets do some reading . . .
RAM
What is RAM
Random Access Memory (RAM) is temporary data storage that the CPU uses during calculations. The more RAM a device has, the more calculated results the CPU can store - which means less time the CPU has to do the same thing over and over again. In other words, the CPU can check RAM to see if it has already made a particular calculation in the recent past. If it has, it can use the pre-computed results instead of wasting processing time recomputing the same calculation. In short, more RAM means a more efficient (and faster) device.
SWAP
What is SWAP
Swap is, in short, virtual RAM. With swap, a small portion of the hard drive is set aside and used like RAM. The computer will attempt to keep as much information as possible in RAM until the RAM is full. At that point, the computer will begin moving inactive blocks of memory (called pages) to the hard disk, freeing up RAM for active processes. If one of the pages on the hard disk needs to be accessed again, it will be moved back into RAM, and a different inactive page in RAM will be moved onto the hard disk ('swapped'). The trade off is disks and SD cards are considerably slower than physical RAM, so when something needs to be swapped, there is a noticeable performance hit.
Unlike traditional swap, Android's Memory Manager kills inactive processes to free up memory. Android signals to the process, then the process will usually write out a small bit of specific information about its state (for example, Google Maps may write out the map view coordinates; Browser might write the URL of the page being viewed) and then the process exits. When you next access that application, it is restarted: the application is loaded from storage, and retrieves the state information that it saved when it last closed. In some applications, this makes it seem as if the application never closed at all. This is not much different from traditional swap, except that Android apps are specially programed to write out very specific information, making Android's Memory Manager more efficient that swap.
Step by Step Guide
How to create Swap Partition
Using MiniTool Partition Wizard
Plug in you MicroSD HC Card to your computer using the card adapter. (Do not use USB Mount)
Open MiniTool Partition Wizard and look for the card
Right Click on it and select Delete Partition
Click on Apply to Delete the Partition
Right Click on it again and select Create Partition
Set the partitions as follows:
1st partition:
Label: Android-SD
Create as: Primary
File System: Fat32
Partition size: as much as you want!
2nd partition:
Label: Android-EXT3 (2nd partition is for EXT which you can use for A2SD or Link2SD)
Create as: Primary
File System: EXT3 (be it a custom kernel or ROM with EXT4 support, use EXT3 still -play safe! )
Partition size: MIN: 256 MB MAX: 1024MB (1GB)
3rd partition:
Label: (do not put anything)
Create as: Primary
File System: Linux Swap
Partition size: MIN: 32MB MAX: 1024MB(1GB) RECOMMENDED: 256MB
After creating partitions, click Apply to apply changes.
Using ClockWorkMod
Reboot to Recovery
Go to Advanced and Debugging
Select partition SD card and select the partition size that delights you
How to use Swap
For us to be able to use swap file or swap partition, we need to use Swapper2 which you can get from Google Play.
Download and Install Swapper2 (of course)
After installing, open Swapper2 and navigate to Menu > Settings
Swapper preferences: (for kernels that doesn't have swap partition support)
Run swapper at startup (put a check)
Swap place: /sd card/swapfile.swp (you can place it in a folder if you don't like a messy sd card structure )
Swap size: MIN: 10 MB MAX: 256MB RECOMMENDED: 32MB (choose any)
Swapiness: RECOMMENDED: 10MB SYSTEM DEFAULT: 60MB MAX: 100MB (choose any)
Safe unmount (put a check)
Safe remount (put a check)
Advanced preferences: (for Kernels that supports swap partition only)
Use swap partition (put a check)
Swap partition: /dev/block/mmcblk1p2
After setting preferences, press back and tap on "ON" to turn on swap. Reboot afterwards
How can I tell if swap is running?
Go to the terminal emulator - or open adb shell - and run 'free'.
If it looks like this (with zeros in the swap line), you do not have swap:
If it looks like this (with anything other than zeros in the swap line), you do have swap:
NOTE:
You need to turn off swap before you mount SD via USB, if you don't you will not be able to mount sd as swapfile is active and set to read only which will deny request to mount USB Storage.
Get Swapper2 here:
Thanks to kalhimeo who attached the the apk file on this POST or click this ATTACHMENT LINK to download.
Android being an open source OS, offers limitless possibilities of optimization and customization as per your requirements. But, half the charm of an Android phone lies in the root-based apps, beautiful mods and patches, and custom ROMs. If you have not rooted your phone yet, believe me you are not getting the most out of it. Rooting offers many advantages indeed but, at the same time it is also a little risky as it breaks into the wall of security build by the operating system.
According to a survey, 80% of Android phone users live happy with an unrooted device and the reasons for this are various- some people think of it as a sort of criminal activity, some are afraid of losing warranty, some are afraid of bricking their phone, while most people do not even know about the existence of a term like “rooting”.
Most people root their phones to get rid of pre installed bloats and gapps which they don't need at all ! ! But why??
They just wanna have more free internal storage. Many of the android users haven't heard of Link2SD ! So, I am here to tell you everything about this awesome app.
Android is one of the most used and popular operating system for the mobile.Day by day several new apps are getting available for the android devices, but your limited internal memory restricts it to the certain limit.Old Android phones have internal memory around 200 to 300 MB (Mega Bytes) unlike the latest one which have in few GB (Giga Bytes). Due to this limited memory, you cannot install more apps. This problem can be overcome by increasing internal memory of your mobile. This is absolutely true that no way to increase internal storage size of your phones, but you can allocate some part of your memory card for your phone to install applications.
This app will help you to link some part of your external SD card storage(whatever amount you want, no restrictions) to the internal storage of your phone. Apps and Games will be linked to that external SD card storage helping you to protect your internal storage from being used.
Believe me, I use Moto E which comes with 2.2 GB user available internal storage. I have 32 GB external SD card and I have linked 20 GB of it to my internal storage.
Now, I have 242 apps n games installed and still have 1.8 GB internal storage free. Apps like app2SD, appmgr have certain limitations as they move only some part of application files only whereas Link2SD links everything (app, cache, data) allowing you to install a large number of apps and games even if your phone have lesser internal storage. Isn't it cool ? ?
It is cool but to be able to use Link2SD you will have to do some steps. Many people don't know what to do after installing this app and that's why they complain it as an useless app. But believe me, it is a great app
Enough talking, let get to work ! !
Pre-Requisites:
1. Phone should be rooted. There are many methods available to root your phone.
2. You need a windows Pc and a card reader.
3. You must take a backup of your memory card on your computer as all the data will be deleted during this process.
4. Download and install Partition Tool to your computer. The link is
http://www.partitionwizard.com/free-partition-manager.html
5. Downloaded Link2SD app from Google play store. You will get it easily.
Steps:
1. Take backup of your memory card on your computer.
2. Remove your SD card from your Mobile and insert it in your computer using card reader for making partition. Never use USB cable for this.
3. Download and install Partition Tool from the above link. Run this partition tool and select MiniTool Partition Wizard.
4. You will see the different drives and disks of your pc. Identify your memory card, right click on it and select delete. It will delete the entire contents of your memory card.
5. Now, you will see your memory card showing unallocated space. Now, right click on your memory card and select create.
6. Select primary in it. If your card storage is more than 2 GB, then select FAT32 file system otherwise select FAT file system.
7. Enter the amount of space which you don't want to link with internal storage. You can use this space for storing music, videos and other files. Your pc and mobile will recognise this space only as your external storage. So, choose wisely. I had 32 GB memory card(29.4 user available). I wanted to link 20 GB to my internal storage. So, I entered the remaining 9.4 GB in partition size.
8. After entering the partition size, click OK. Now, you will see the remaining space as unallocated. Right click on it and select Create. Create as primary and ext2 file system, select the remaining size. This size will be linked to the internal storage. Click OK.
You must select primary in both the partitions.
9. Now, click on the apply button on left corner menu. It will take sometimes to create partition. You will get a message showing that the partition is successful.
10. Now, copy your backup data to your memory card and take out your memory card from card reader and insert it in your phone.
11. Start your phone. Download link2sd app from Play Store. Install it and open. It will ask you to grant root permission, grant it. On opening, you will see a tab asking you to select the file system of your second partition, choose ext2. If you do not get the tab, then in Link2SD app, go to menu and click on RECREATE MOUNT SCRIPTS and select the file system of your second partition, choose ext2.
12. Now, it will ask you to reboot, select OK. If you have done 2 partition of your card and both as primary. Then, it will link the ext2 partition to your internal storage.
13. After reboot, open Link2SD app. You will see a funnel type icon, click on it and choose internal. It will show the apps which are stored in internal memory of your phone. Click on the option key and select "multi-select", press select all option. All the apps will be selected.
14. Then click on option key, choose option and select "create link" and select all options.
15. If you will pay 2$ for Link2SD plus app, then you will have the option of linking app data. Otherwise, choose the first three options.
16. Link2SD will link all these apps to the secondary partition of your SD card and your internal storage will be increased. That is it.
Note: You can use Link2SD app to uninstall pre-installed apps, move apps to SD card. You should select AUTO LINK option in settings, it will automatically link new apps to SD card. You can select INSTALL LOCATION. I must say, you should pay 2$ for Link2SD plus. It will link all app data to ext2.
Don’t be shy and leave any questions.
Thank You. Have a smiling Day
Hit thanks, if helped :good: