[GUIDE][HOW-TO]Use SWAP As Virtual RAM Without Partitioning SD Card - Galaxy Y GT-S5360 General

Firstly what is swap, you should know about it before
you go further
What is Swap:-
Swap space in Linux is used when the amount of
physical memory (RAM) is full. If the system needs
more memory resources and the RAM is full, inactive
pages in memory are moved to the swap space. While
swap space can help machines with a small amount of
RAM, it should not be considered a replacement for
more RAM. Swap space is located on hard drives, which
have a slower access time than physical memory.
Swap space can be a dedicated swap partition, a swap
file, or a combination of swap partitions and swap files.
Normally the swap space should be equal to the Actual
physical Ram
Click to expand...
Click to collapse
.
LEGAL WARNING-Read This before you proceed
I and XDA is not responsible for any damage done to your device..........
Click to expand...
Click to collapse
Requirements for this process:-
* Kernel which supports swap(Deviant,Hells,GNU,Merruk)etc
* Rooted galaxy y
* Busybox (atleast v1.18)
* Terminal Emulator
Click to expand...
Click to collapse
Steps to enable swap:-
1. Open any file explorer(I prefer root explorer) and create a folder and name
it swap
2. Browse to that folder and create a file named swap
3. Open terminal Emulator and type the code busybox
mkswap /sdcard/swap/swap xxxxxx
(xxxxxx is the amount in KB, eg:- 383456 = 378MB),
and this process will take time.)
4. Now we will activate the swap and to activate it type
in terminal busybox swapon /sdcard/swap/swap
5. The last step is to turn on swappiness and to do it
we write echo 100 > /proc/sys/vm/swappiness in
terminal
And now you are done to check the working of swap
type busybox free in terminal emulator.
NOTE-Last two steps are needed to be done after every boot
so it is better to make a script which can be started
from script manager......... and here is a script ready for this Swap.sh
REGARDS
You Can Rate This Thread 5 Stars......I won't ask for thank......if I deserve it..go ahead.....please do not copy the work to any other forum
Click to expand...
Click to collapse

Reserved
Feedback and WARNING by users
thewarlord said:
No confusion dude!!
Watch ur ram in task manager !! Its always in motion (increase & decrease) I think u understand that life of sd card depend on writeing amount !! Ok
If u create a swap in sd card or swap partition !! Its always write on sd card I think u r understanding my feelings!! so, It decrease the sd card life!!
Click to expand...
Click to collapse
New Method Using SWAPPER2.apk
Here the step :
go to settings -> swap place (put correct directory for
example: /sdcard/swap 128 ) bold text depend on your
swap name!
Tick "Safe Unmount" and "Safe Remount", u dont need
to turn off or turn on again before and after sharing sd
IMPORTANT!! :
go to Advanced preferences -> untick "Recreate
swap file" and "Reformat swap" MUST!!

D4rkSh4dow said:
Firstly what is swap, you should know about it before
you go further
.
LEGAL WARNING-Read This before you proceed
Steps to enable swap:-
1. Open any file explorer(I prefer root explorer) and create a folder and name
it swap
2. Browse to that folder and create a file named swap
3. Open terminal Emulator and type the code busybox
mkswap /sdcard/swap/swap xxxxxx
(xxxxxx is the amount in KB, eg:- 383456 = 378MB),
and this process will take time.)
4. Now we will activate the swap and to activate it type
in terminal busybox swapon /sdcard/swap/swap
5. The last step is to turn on swappiness and to do it
we write echo 100 > /proc/sys/vm/swappiness in
terminal
And now you are done to check the working of swap
type busybox free in terminal emulator.
NOTE-Last two steps are needed to be done after every boot
so it is better to make a script which can be started
from script manager......... and here is a script ready for this Swap.sh
REGARDS
Click to expand...
Click to collapse
you can simply use the app swapper for doing this

ok the info is good,but i hope you know about sdcard lifedecrease by using swap.it kills sdcards.

-CALIBAN666- said:
ok the info is good,but i hope you know about sdcard lifedecrease by using swap.it kills sdcards.
Click to expand...
Click to collapse
Sir,hav a look at OP,it says without SD Card paritition.....no use of sd card in this.....

oops my fail,anyway,have you fell a better performance?you didnt need so complex settings,just use System Control from Juwe11.

D4rkSh4dow said:
Sir,hav a look at OP,it says without SD Card paritition.....no use of sd card in this.....
Click to expand...
Click to collapse
no use of sd card ??? then where the file swap is created

internal system patition

-CALIBAN666- said:
internal system patition
Click to expand...
Click to collapse
3. Open terminal Emulator and type the code busybox
mkswap /sdcard/swap/swap xxxxxx
I don't think so
and it is galaxy y section sir we don't have internal memory to install enough apps so where to create a swap folder

apps???????its about ram,dude

sangalaxy said:
no use of sd card ??? then where the file swap is created
Click to expand...
Click to collapse
I meant no need of sd partition........why don't you read the whole post again before posting smthng

-CALIBAN666- said:
apps???????its about ram,dude
Click to expand...
Click to collapse
yes I know sir but you said the swap folder is in internel memory so iwas just pointing out that we only have 190mb data folder and no internel sd partotion
---------- Post added at 01:03 PM ---------- Previous post was at 01:01 PM ----------
D4rkSh4dow said:
I meant no need of sd partition........why don't you read the whole post again before posting smthng
Click to expand...
Click to collapse
yes I know friend but partition or not you have to create a swap folder in sd card which serves as a virtual partition

bro apps are not the same like ram,google for more infos.

Or do a xda search

-CALIBAN666- said:
bro apps are not the same like ram,google for more infos.
Click to expand...
Click to collapse
yes I know sir but iam not saying about the apps ok lets make it clear by using your method we create a folder named swap in the sdcard and it serves as a virtual rom right??
and I was only saying that as caliban666 said continuos read and write in sdcard will decrease its life whether it is a partion or a folder

sangalaxy said:
yes I know sir but iam not saying about the apps ok lets stop this its going outoff topic
Click to expand...
Click to collapse
Yes,u r rite.....btw if u tried it u can post some ss here
I'll add to the OP

D4rkSh4dow said:
Yes,u r rite.....btw if u tried it u can post some ss here
I'll add to the OP
Click to expand...
Click to collapse
sorry about ss friend anyway thanks for the post

i dont know but has anyone read this"tweak"?it creates a swap part on sd,otherwise its not fully working.

-CALIBAN666- said:
i dont know but has anyone read this"tweak"?it creates a swap part on sd,otherwise its not fully working.
Click to expand...
Click to collapse
Did you tried it sir?

no i didnt need to use it,all what i need to know i see,the other thing is swap is buggy for some roms and kernel(my expierence and opinion).

Related

[Cuestion] Swap Partition on CyanogenMod 7.2

I tried every way, but I can not use the swap partition on my WFS.
I installed the latest version of the ROM and the Kernel, but I can't make it work.
Does anyone know what should I do to run the "Swap Partition" on my phone?
Go through this.
http://wiki.cyanogenmod.com/wiki/Swap_and_Compcache
The cyanogenmod team feels that swap doesn't serve it's purpose on an Android device. To quote them
"This question is hotly debated, but you almost definitely do not need swap or compcache. The only exception to this may be if the device is a first generation device (i.e. HTC Dream or HTC Magic). If you think swap or compcache may make the device faster, feel free to follow the directions below."
Click to expand...
Click to collapse
And the WFS is not a first generation device
If you still want to go ahead with it, that link provides a how-to.
But the problem is that with this ROM my phone does not recognize the swap partition. I would like to post on its own thread, but I can not because I am a new user.
DanHidalgo said:
I tried every way, but I can not use the swap partition on my WFS.
I installed the latest version of the ROM and the Kernel, but I can't make it work.
Does anyone know what should I do to run the "Swap Partition" on my phone?
Click to expand...
Click to collapse
You have to create a mount script and copy it to /system/etc/init.d and give it the same permissions all the other files in init.d
Attached is the code to use if you have swap as the third partition on your SD card. Remove the .txt extension and place it in /system/etc/init.d and give it the appropriate permissions then reboot
Use the command "free" in a terminal session to verify swap is active and working.
It should be pretty straightforward to modify it to be the second if you aren't using an SD Ext partition for programs.
The code is:
Code:
#!/system/bin/sh
#Checks for a swap partition on mount 3 of the SD card and use it for swap partition.
if [ -b /dev/block/mmcblk0p3 ];
then
#Uncomment the line below to adjust swappiness. Default is 60 I believe
# echo 20 > /proc/sys/vm/swappiness;
swapon /dev/block/mmcblk0p3;
fi;
Change the line:
if [ -b /dev/block/mmcblk0p3 ];
to
if [ -b /dev/block/mmcblk0p2 ];
If you only have your FAT32 Primary and your Swap partition and no SDExt
I will try it this evening. Some people told me that oboe is that I created the Swap Partition with the recovery and I have to create it with the PC.
If I get it working I'll post my results. If not you will see me here again.
Enviado desde mi HTC Wildfire S usando Tapatalk
d33ps1x said:
You have to create a mount script and copy it to /system/etc/init.d and give it the same permissions all the other files in init.d
Attached is the code to use if you have swap as the third partition on your SD card. Remove the .txt extension and place it in /system/etc/init.d and give it the appropriate permissions then reboot
Use the command "free" in a terminal session to verify swap is active and working.
It should be pretty straightforward to modify it to be the second if you aren't using an SD Ext partition for programs.
The code is:
Code:
#!/system/bin/sh
#Checks for a swap partition on mount 3 of the SD card and use it for swap partition.
if [ -b /dev/block/mmcblk0p3 ];
then
#Uncomment the line below to adjust swappiness. Default is 60 I believe
# echo 20 > /proc/sys/vm/swappiness;
swapon /dev/block/mmcblk0p3;
fi;
Change the line:
if [ -b /dev/block/mmcblk0p3 ];
to
if [ -b /dev/block/mmcblk0p2 ];
If you only have your FAT32 Primary and your Swap partition and no SDExt
Click to expand...
Click to collapse
When I try to move the script to the specific file I get: failed to copy, or failed to move. How could I copy or move the script in /system/etc/init.d and give all permissions? I am using ES File Explorer and ASTRO. Should I move the zipped file or only the script? I couldn't move none of them
Portugah said:
When I try to move the script to the specific file I get: failed to copy, or failed to move. How could I copy or move the script in /system/etc/init.d and give all permissions? I am using ES File Explorer and ASTRO. Should I move the zipped file or only the script? I couldn't move none of them
Click to expand...
Click to collapse
You have to mount system partition as RW to be able to manipulate with files there, big white button "Mounr R/W" in the upper part of the Root explorer app while you are in /system/etc/init.d folder. Then you put there swap.txt file that d33ps1x provided up in the post, rename it just to swap and reboot phone.
I did that with almost every version of cm7 from the begining (in which kernel allowed that) and every time it worked, tnx to d33ps1x
kobredabre said:
You have to mount system partition as RW to be able to manipulate with files there, big white button "Mounr R/W" in the upper part of the Root explorer app while you are in /system/etc/init.d folder. Then you put there swap.txt file that d33ps1x provided up in the post, rename it just to swap and reboot phone.
I did that with almost every version of cm7 from the begining (in which kernel allowed that) and every time it worked, tnx to d33ps1x
Click to expand...
Click to collapse
Root explorer is a paid app. Is there any other app I could do that?
Portugah said:
Root explorer is a paid app. Is there any other app I could do that?
Click to expand...
Click to collapse
Total commander for android can do same:
http://forum.xda-developers.com/showthread.php?t=1619734
and it's free
kobredabre said:
Total commander for android can do same:
http://forum.xda-developers.com/showthread.php?t=1619734
and it's free
Click to expand...
Click to collapse
Once installed the app, how do I grant permissions to the file? the link shows images from the older version.
Portugah said:
Once installed the app, how do I grant permissions to the file? the link shows images from the older version.
Click to expand...
Click to collapse
Push and hold the file, choose properties and then hit first button right from the file name and current permissions to expand the menu
kobredabre said:
Push and hold the file, choose properties and then hit first button right from the file name and current permissions to expand the menu
Click to expand...
Click to collapse
I moved the file to the specific folder and I restarted my phone. Opening a2sd the swap button was turned off. I opened the terminal and I typed free, the results are 0-0-0. I didn't work.
Portugah said:
Once installed the app, how do I grant permissions to the file? the link shows images from the older version.
Click to expand...
Click to collapse
I granted permissions to the file using Total Commander app. Thank you. But it looks like it is not working yet.
Portugah said:
I granted permissions to the file using Total Commander app. Thank you. But it looks like it is not working yet.
Click to expand...
Click to collapse
Then the problem can be with kernel on ROM you are using, basic thing is that kernel needs to be abble to support swap for swap to even work... Can't help you much there since you are probably on marvelc version according to you'r country flag, i'm on diferent version. Some1 with same model as yours could help you tough
Is there any way to install another ROM that support swap? which ROM should I use? is there any tutorial?
Portugah said:
Is there any way to install another ROM that support swap? which ROM should I use? is there any tutorial?
Click to expand...
Click to collapse
The [2nd] above post is correct. Swap support is enabled in some custom kernels. If you're looking for another ROM, you're going to primarily ask about the kernel included with that ROM. Stock kernels do NOT support swap. You can enable swap [if you have a supporting kernel] via A2SDGUI or terminal... read up and familiarize yourself with linux swap.. since Android is a branch of Linux; same principles apply
Rob
Sent from my HTC_A510c using Tapatalk 2
This says it's possible to enable swap and compcache on CM7.2, but the howto wiki link is dead
To answer you question directly, by default the swap and Compcache schemes are disabled, but if you still feel the need to use them, above link provides you with a how-to.
So, yes, the CyanogenMod 7.2 supports swap and its usage needs to be activated.
Click to expand...
Click to collapse
Any idea how to do this?
For me the same question. I'm investigating since 1 week, tried scripts etc. no chance
Nexus One,
4EXT recovery (needed for correct sd-ext formatting)
CM 7.2
swap partition is there but not used.
What could i do to enable the swap partition?
Regards,
Marc
Hello,
I have the stable release cyanogenmod 7.2.0.
Swap is not working and gives following message:
swapon: /dev/block/mmcblk0p3: Function not implement
I found some notes saying that the problem is the kernel not supporting
swap. Which kernel can I use with cyanogenmod 7.2.0 with swap support?.
Thanks for your help.

[HOW TO] Create Swap File For Galaxy W

Cheers! This is my first thread. Hopeful i'm not reposting similar thread.
I will tell you how to create swap file for our W. Anyway, swap file works like swap partition. It can help your RAM for improve our W performance.
1. Root your phone
2. Install Superuser
3. Install Busybox
4. Install Terminal Emulator
If you are using CM10 from arco, that's mean you don't need to follow first 4 steps.
5. Open Terminal Emulator
6. Change directory to external sd card (external is recomended, because we won't take some spaces on internal sd card)
Code:
[email protected]:~$ su
[email protected]:~# cd /external_sd
7. Create swap file under external_sd directory. I will create 512MB swap file. If you wanna create other size of swap file, just change value of count. 512 is recomended.
Code:
[email protected]:/external_sd# dd if=/dev/zero of=swapfile bs=1M count=512
8. Set the right permissions (a world-readable swap file is a huge local vulnerability)
Code:
[email protected]:/external_sd# chmod 600 swapfile
9. After creating the correctly-sized file, format it to swap:
Code:
[email protected]:/external_sd# mkswap swapfile
10. Activate the swapfile:
Code:
[email protected]:/external_sd# swapon swapfile
11. Check your swap, whether is work or not.
Code:
[email protected]:/external_sd# free -m
Check your swap, if the value exactly like your value on 7th step, then you did it!
Any question? Just ask here.
You did it? Why U No hit thanks button?
This does not create a partition right? Just a swap file.. Like the paging file in windows?
My only concern is does it really help that much? What I mean is a user noticeable difference. Also would it make the lifespan of the SDcard shorter? Higher the class of the card, the better it is???
I have never done swap on my older phones and I really would like to do it if it makes a whole a lot of difference in terms of usage.
Also can you also let us know how to revert back in case one does not like it? Just delete the file?
Thanks for your answer in advance.
[/QUOTE]
thearif said:
This does not create a partition right? Just a swap file.. Like the paging file in windows?
Click to expand...
Click to collapse
No, it does not.
Yes, somewhat similar.
thearif said:
My only concern is does it really help that much? What I mean is a user noticeable difference.
Click to expand...
Click to collapse
Totally depends on your usage pattern.
thearif said:
Also would it make the lifespan of the SDcard shorter?
Click to expand...
Click to collapse
Yes, probably. That's why you shouldn't create a swapfile anywhere but the External SD.
thearif said:
Higher the class of the card, the better it is???
Click to expand...
Click to collapse
Of course.
thearif said:
Also can you also let us know how to revert back in case one does not like it? Just delete the file?
Click to expand...
Click to collapse
Reboot, then delete the file.
Sent from my GT-I8150 using xda app-developers app
Boosting Perfomance?
RezaBeye said:
Boosting Perfomance?
Click to expand...
Click to collapse
Totally depends on your usage pattern.
Sent from my GT-I8150 using xda app-developers app
omegahanggara said:
Cheers! This is my first thread. Hopeful i'm not reposting similar thread.
I will tell you how to create swap file for our W. Anyway, swap file works like swap partition. It can help your RAM for improve our W performance.
1. Root your phone
2. Install Superuser
3. Install Busybox
4. Install Terminal Emulator
If you are using CM10 from arco, that's mean you don't need to follow first 4 steps.
5. Open Terminal Emulator
6. Change directory to external sd card (external is recomended, because we won't take some spaces on internal sd card)
Code:
[email protected]:~$ su
[email protected]:~# cd /external_sd
7. Create swap file under external_sd directory. I will create 512MB swap file. If you wanna create other size of swap file, just change value of count. 512 is recomended.
Code:
[email protected]:/external_sd# dd if=/dev/zero of=swapfile bs=1M count=512
8. Set the right permissions (a world-readable swap file is a huge local vulnerability)
Code:
[email protected]:/external_sd# chmod 600 swapfile
9. After creating the correctly-sized file, format it to swap:
Code:
[email protected]:/external_sd# mkswap swapfile
10. Activate the swapfile:
Code:
[email protected]:/external_sd# swapon swapfile
11. Check your swap, whether is work or not.
Code:
[email protected]:/external_sd# free -m
Check your swap, if the value exactly like your value on 7th step, then you did it!
Any question? Just ask here.
You did it? Why U No hit thanks button?
Click to expand...
Click to collapse
Good evening,
when i put command "[email protected]:/external_sd# mkswap swapfile" phone give following message:
"image is too small"
can i continue??
Tks in advance
moonwonder said:
Good evening,
when i put command "[email protected]:/external_sd# mkswap swapfile" phone give following message:
"image is too small"
can i continue??
Tks in advance
Click to expand...
Click to collapse
Please post here the result of the 'ls -la' command in the directory where you created your swapfile.
Sent from my GT-I8150 using xda app-developers app
R: [HOW TO] Create Swap File For Galaxy W
in attachment.
tks
Sent from my GT-I8150 using xda app-developers app
R: [HOW TO] Create Swap File For Galaxy W
moonwonder said:
in attachment.
tks
Sent from my GT-I8150 using xda app-developers app
Click to expand...
Click to collapse
i'm seeing that file size is 512 byte and not Mbyte...
Sent from my GT-I8150 using xda app-developers app
moonwonder said:
in attachment.
tks
Sent from my GT-I8150 using xda app-developers app
Click to expand...
Click to collapse
Have you installed the latest Busybox by Stericson?
R: [HOW TO] Create Swap File For Galaxy W
resolved:
changing count number on 'dd' function. (from 512 to 536870919)
i suppose that my busybox don't support byte size (bs=1M)
tks.
Sent from my GT-I8150 using xda app-developers app
moonwonder said:
resolved:
changing count number on 'dd' function. (from 512 to 536870919)
i suppose that my busybox don't support byte size (bs=1M)
tks.
Sent from my GT-I8150 using xda app-developers app
Click to expand...
Click to collapse
You should instead try changing bs=1M to bs=$((1024*1024))
Reason: Flash memory works in blocks. bs is the amount of data being written at a time. If you write 1 byte at a time, you're writing thousands of times to the same block, which not only makes the process slower, but also shorten the life of your Flash memory (because, appending 1 byte requires a cycle of: read the whole block, add one byte, write back the whole block).
The largest Flash memory block size I can ascertain from specs on the Internet is 128 KiB. Thus, bs=$((1024*1024)) would be suitable (1 MiB is an integer multiple of 128 KiB).
If your dd doesn't support the bs parameter at all, you really should replace it with one that does.
Sent from my GT-I8150 using xda app-developers app
R: [HOW TO] Create Swap File For Galaxy W
thanks!!!
now i understand reason that the time for swap creation was about 3 hours...ahahaha
in attachment my new swap!
Sent from my GT-I8150 using xda app-developers app
moonwonder said:
thanks!!!
now i understand reason that the time for swap creation was about 3 hours...ahahaha
in attachment my new swap!
Sent from my GT-I8150 using xda app-developers app
Click to expand...
Click to collapse
LOL... with bs=$((1024*1024)), I took only about 1.5 minutes:
Code:
[email protected]:/ $ cd sdcard
ro of=tes.fil bs=$((1024*1024)) count=512 <
512+0 records in
512+0 records out
536870912 bytes transferred in 86.185 secs (6229284 bytes/sec)
[email protected]:/sdcard $
Sent from my GT-I8150 using xda app-developers app
I followed a thread to make an ext2 partition (about 1 GB, unfortunately couldn't make it divisible by 256)
then read this thread and another one so i created a swapfile in that partition ( data/sdext2/ ) . now i have a couple of question about the swapfile
1.is that line important & why ??
omegahanggara said:
8. Set the right permissions (a world-readable swap file is a huge local vulnerability)
Code:
[email protected]:/external_sd# chmod 600 swapfile
Click to expand...
Click to collapse
it's not present in pepoluan's code
pepoluan said:
To create a swap RAM:
Code:
su
targ=/mnt/sdcard/.swapfile
dd if=/dev/zero of=$targ bs=$((1024*1024)) count=64
mkswap $targ
Click to expand...
Click to collapse
2. for heavy games, which is more recommended : 256 or 128 MB swapfile, pep said 64 which will b a bummer for me
pepoluan said:
I have experimented *a lot* with swap memory, and I can tell you with absolute confidence:
Swap files larger than 64 MiB *will* result in additional lags. Larger than 128 MiB, your phone will be very slow.
To activate, you don't need to reboot.
Go to the Terminal and enter the command:
cd /mnt/sdcard
ls .*
(replace "sdcard" with the actual location of where you created the swap file, of course)
Click to expand...
Click to collapse
one last thing : is the ls.* code different from the swapon code or they r the same ??
I made an sh file for this and placed it in init.d coz i want it to automatically run when the system boots. However it didn't work.
So for now i just placed it in /system/bin so that i only need to type enable_swap in the terminal.
Any way to make it work in init.d?
Any Answer ???
klacenas said:
I made an sh file for this and placed it in init.d coz i want it to automatically run when the system boots. However it didn't work.
So for now i just placed it in /system/bin so that i only need to type enable_swap in the terminal.
Any way to make it work in init.d?
Click to expand...
Click to collapse
I assume you put the swap file in /sdcard ?
The first partition of the SD Card does not get mounted until all scripts in init.d have finished. I'm experimenting with Stericson's new BusyBox, which includes the 'nohup' command.
Sent from my GT-I8150 using xda app-developers app
pepoluan said:
I assume you put the swap file in /sdcard ?
The first partition of the SD Card does not get mounted until all scripts in init.d have finished. I'm experimenting with Stericson's new BusyBox, which includes the 'nohup' command.
Sent from my GT-I8150 using xda app-developers app
Click to expand...
Click to collapse
Yes I put it in sdcard. Thanks for the explanation. Please share if you succeed.
Edit: if its not possible through init.d, is there another way of automatically executing a script after init.d?
Sorry not really a Linux person, I'm more familiar with autoexec.bat
Sent from my GT-I8150 using xda app-developers app
klacenas said:
Yes I put it in sdcard. Thanks for the explanation. Please share if you succeed.
Edit: if its not possible through init.d, is there another way of automatically executing a script after init.d?
Sorry not really a Linux person, I'm more familiar with autoexec.bat
Sent from my GT-I8150 using xda app-developers app
Click to expand...
Click to collapse
Install SManager, add the script as a boot script. Boot scripts run using SManager always run after SD Card mounts.
Sent from my GT-I8150 using xda app-developers app

swap internal and external SD cards

I made this post over in the HellyBean thread as one user was asking about it, and I decided I would post it in an easier to find place.
Basically it is a shell script that you can toss into /data/loca/userinit.d (if your ROM supports userinit.d, otherwise throw it in /system/etc/init.d) that will swap your internal and external SD cards.
Using this script is at your own risk. Any bricks, fires, alien invasions, etc are not my fault... well, unless they are. I have run this script on my phone and it seems to do as I claim it does.
This script has ONLY been tested on a SGH-T989D phone running the ROM Hellybean on Android 4.3. Based on my memory, I believe this should work on 4.2.2 ROMs as well and should not be dependant on one specific ROM. If you wish to make sure it will work with your ROM, run the following command from the shell/terminal:
mount | grep sdcard
if you see /dev/block/vold/179:97 and /dev/block/vold/179:28 and tempfs as your 3 SD cards, you are good to go. If you get any different values, this script will NOT work for you unless you modify it to match your values. I STRONGLY recommend you check your mount points before running the script as mounting an incorrect partition to your SD card (internal or external) can do unexpected things. If you unintentionally mount your recovery or boot, you could easily corrupt these. I accept no responsibility if anything goes wrong. Make sure you do all of this as root as well where applicable.
STEPS:
1) backup your internal and external SD cards
2) take a nandroid (never hurts to do a nandroid before making a startup script)
3) download the zip file and extract the swapsd.sh file (NOTE: this is NOT a flashable zip. do NOT attempt to flash this from recovery. If you do, you do so at your own risk)
4) copy the script to your phone (however you wish to do that is up to you)
OPTIONAL STEPS
5) copy the script to /data/local
6) run the script
7) verify that your internal and external SD cards are swapped
END OF OPTIONAL STEPS
8) do one of the following:
8A) copy the script to /data/loca/userinit.d
8B) copy the script to /system/etc/init.d (NOTE: you will need to mount /system as RW)
9) change the permissions on the file to 755 (or rwxr-xr-x)
10) reboot and your SD cards will be swapped.
I strongly recommend doing the optional steps as if they fail for any reason, then you do NOT want to run this as a boot script.
Below is the script if you are curious what it is actually doing:
#/sys/xbin/bash
while [ `mount | grep -c sdcard` -lt 3]
do
sleep 10
done
umount /storage/sdcard0/.android_secure
umount /storage/sdcard0
umount /storage/sdcard1
mount /dev/block/vold/179:97 /storage/sdcard0
mount /dev/block/vold/179:28 /storage/sdcard1
mount -t tmpfs -o ro,seclabel,size=0k,mode=000 tmpfs /storage/sdcard0/.android_secure
man how do this does it work really want it kinda lost on how to do it
astonmartin214 said:
man how do this does it work really want it kinda lost on how to do it
Click to expand...
Click to collapse
Pretty easy... copy the files in the attached zip to /data/local/userinit.d if your kernel supports it...otherwise out it at /system/etc/init.d
I would first try running it from anywhere to verify works for though
Sent from my SM-T310 using xda app-developers app
bmg002 said:
Pretty easy... copy the files in the attached zip to /data/local/userinit.d if your kernel supports it...otherwise out it at /system/etc/init.d
I would first try running it from anywhere to verify works for though
Sent from my SM-T310 using xda app-developers app
Click to expand...
Click to collapse
don't get it still lost wish U could make a video of it
astonmartin214 said:
don't get it still lost wish U could make a video of it
Click to expand...
Click to collapse
I'll see what I can do... won't be very exciting as it is all command prompt crap...
Want me to write a pc app for it?
I'll need to look up the rules for distributing adb...
Sent from my SAMSUNG-SGH-T989 using xda app-developers app
astonmartin214 said:
don't get it still lost wish U could make a video of it
Click to expand...
Click to collapse
What part are you stuck at?
can't find the data/local or the file
astonmartin214 said:
can't find the data/local or the file
Click to expand...
Click to collapse
es file explorer then hit the second button on top to get to device, the folder is under there....might have to hit it twice
Your probably overthinking it, I looked it over and the longest process is making a backup...
what rom r u using?
ill walk u step by step if need be....
minlo said:
es file explorer then hit the second button on top to get to device, the folder is under there....might have to hit it twice
Your probably overthinking it, I looked it over and the longest process is making a backup...
what rom r u using?
ill walk u step by step if need be....
Click to expand...
Click to collapse
I'm running carbon ROM & I use es file
astonmartin214 said:
I'm running carbon ROM & I use es file
Click to expand...
Click to collapse
Did you find device with steps given?
keep in mind the carbon i bleave you running it kkat n mod steps are 4.3 based, not sure if it matters but wanted to that out....
minlo said:
Did you find device with steps given?
Click to expand...
Click to collapse
yes I did
go to data then local
reply back
---------- Post added at 08:52 PM ---------- Previous post was at 08:50 PM ----------
place unzipped scrpt file there
Run script file
I hope you already made ur backups as stated by op
---------- Post added at 09:04 PM ---------- Previous post was at 08:52 PM ----------
astonmartin214 said:
yes I did
Click to expand...
Click to collapse
still with me?
the optional steps are to verify compatibility i bleave
minlo said:
go to data then local
reply back
---------- Post added at 08:52 PM ---------- Previous post was at 08:50 PM ----------
place unzipped scrpt file there
Run script file
I hope you already made ur backups as stated by op
---------- Post added at 09:04 PM ---------- Previous post was at 08:52 PM ----------
still with me?
the optional steps are to verify compatibility i bleave
Click to expand...
Click to collapse
don't really care about backups
astonmartin214 said:
don't really care about backups
Click to expand...
Click to collapse
yeah i keep my first backup and ddriver backup
but if something happens LOL u were warned!
Did u run the script?
what's next
astonmartin214 said:
what's next
Click to expand...
Click to collapse
did they swap? i cant see the screenies good on my phone
one way to tell i bleave is settings, storage
if so we are on step 8 to make it permanant....
I dont have 8a but i have 8b on jedi rom....
hit settings in es file exp, go to root explorer, pick mount system rw
place script in location stated on 8b....
reply back
astonmartin214 said:
what's next
Click to expand...
Click to collapse
The screenshots you attached do not really show much. The root folder contents should not change, but /storage/sdcard0 and /storage/sdcard1 should change contents.
What should happen after running the script (if it was successful, I found with later builds of HellyBean I needed to do a lazy unmount and to use busybox to unmount it) is /storage/sdcard0 and /storage/sdcard1 should swap contents. So sdcard0 is normally your INTERNAL memory and sdcard1 is normally your EXTERNAL memory, so running the command should swap them.
I have not tested it on kitkat, but I believe it should work. I know that later jellybean builds used vold devices instead of mmcblk devices, but I don't think that kitkat would have removed the mmcblk device.
If you like, I can update the script to use busybox and a lazy unmount? I know to remount /data you need to use a lazy unmount as it is in use.
bmg002 said:
The screenshots you attached do not really show much. The root folder contents should not change, but /storage/sdcard0 and /storage/sdcard1 should change contents.
What should happen after running the script (if it was successful, I found with later builds of HellyBean I needed to do a lazy unmount and to use busybox to unmount it) is /storage/sdcard0 and /storage/sdcard1 should swap contents. So sdcard0 is normally your INTERNAL memory and sdcard1 is normally your EXTERNAL memory, so running the command should swap them.
I have not tested it on kitkat, but I believe it should work. I know that later jellybean builds used vold devices instead of mmcblk devices, but I don't think that kitkat would have removed the mmcblk device.
If you like, I can update the script to use busybox and a lazy unmount? I know to remount /data you need to use a lazy unmount as it is in use.
Click to expand...
Click to collapse
I think we lost him LOL
2nd time this week tried helping some noobs and they dissappear...
minlo said:
I think we lost him LOL
2nd time this week tried helping some noobs and they dissappear...
Click to expand...
Click to collapse
Lol or he figured it out... I hope that is the case
Sent from my SM-T310 using xda app-developers app

[Guide]Use swap as virtual ram without partitioning sdcard

Firstly what is swap, you should know about it before
you go further
What is Swap:-
Swap space in Linux is used when the amount of
physical memory (RAM) is full. If the system needs
more memory resources and the RAM is full, inactive
pages in memory are moved to the swap space. While
swap space can help machines with a small amount of
RAM, it should not be considered a replacement for
more RAM. Swap space is located on hard drives, which
have a slower access time than physical memory.
Swap space can be a dedicated swap partition, a swap
file, or a combination of swap partitions and swap files.
Normally the swap space should be equal to the Actual
physical Ram
Click to expand...
Click to collapse
.
LEGAL WARNING-Read This before you proceed
I and XDA is not responsible for any damage done to your device..........
Click to expand...
Click to collapse
Requirements for this process:-
* Kernel which supports swap(Deviant,Hells,GNU,Merruk)etc
* Rooted galaxy y
* Busybox (atleast v1.18)
* Terminal Emulator
Click to expand...
Click to collapse
Steps to enable swap:-
1. Open any file explorer(I prefer root explorer) and create a folder and name
it swap
2. Browse to that folder and create a file named swap
3. Open terminal Emulator and type the code busybox
mkswap /sdcard/swap/swap xxxxxx
(xxxxxx is the amount in KB, eg:- 383456 = 378MB),
and this process will take time.)
4. Now we will activate the swap and to activate it type
in terminal busybox swapon /sdcard/swap/swap
5. The last step is to turn on swappiness and to do it
we write echo 100 > /proc/sys/vm/swappiness in
terminal
And now you are done to check the working of swap
type busybox free in terminal emulator.
NOTE-Last two steps are needed to be done after every boot
so it is better to make a script which can be started
from script manager......... and here is a script ready for this Swap.sh
REGARDS
You Can Rate This Thread 5 Stars......I won't ask for thank......if I deserve it..go ahead.....please do not copy the work to any other forum
Click to expand...
Click to collapse
Method II
2nd method using Swapper2.apk
Here the step :
go to settings -> swap place (put correct directory for
example: /sdcard/swap 128 ) bold text depend on your
swap name!
Tick "Safe Unmount" and "Safe Remount", u dont need
to turn off or turn on again before and after sharing sd
IMPORTANT!! :
go to Advanced preferences -> untick "Recreate
swap file" and "Reformat swap" MUST!!
Thread Closed as requested by OP

path for external sd card ?

I'm trying to get an app to work and have to write a path for the external sd card, can I just use /storage/external_SD ?
try this.
mjb152 said:
I'm trying to get an app to work and have to write a path for the external sd card, can I just use /storage/external_SD ?
Click to expand...
Click to collapse
use this it might help
You can get the path of sdcard from this
code:
String path = Environment.
getExternalStorageDirectory
().getAbsolutePath();
Then specify the foldername and file
name.
if you are using an emulator, double-check
to make sure that you have filled in a
value for the SD Card size.
for kk permission is changed I hope you know.
I can provide code for it also.
for kk-
Your app can not read shared files on the external
storage when running on Android 4.4, unless your app
has the READ_EXTERNAL_STORAGE permission. That
is, files within the directory returned by
getExternalStoragePublicDirectory() are no
longer accessible without the permission. However, if
you need to access only your app-specific directories,
provided by getExternalFilesDir() , then you do
not need the READ_EXTERNAL_STORAGE permission
@SidDev said:
use this it might help
You can get the path of sdcard from this
code:
String path = Environment.
getExternalStorageDirectory
().getAbsolutePath();
Then specify the foldername and file
name.
if you are using an emulator, double-check
to make sure that you have filled in a
value for the SD Card size.
for kk permission is changed I hope you know.
I can provide code for it also.
for kk-
Your app can not read shared files on the external
storage when running on Android 4.4, unless your app
has the READ_EXTERNAL_STORAGE permission. That
is, files within the directory returned by
getExternalStoragePublicDirectory() are no
longer accessible without the permission. However, if
you need to access only your app-specific directories,
provided by getExternalFilesDir() , then you do
not need the READ_EXTERNAL_STORAGE permission
Click to expand...
Click to collapse
coo, thanks !
mjb152 said:
coo, thanks !
Click to expand...
Click to collapse
welcome and you could have pressed the thanks button.
@SidDev said:
welcome and you could have pressed the thanks button.
Click to expand...
Click to collapse
If he has root this will help:
https://play.google.com/store/apps/details?id=nextapp.sdfix
=
http://technofaq.org/posts/2014/04/fixing-external-sd-card-write-issue-on-android-kitkat/
I must have root to fix the SD problems ? (can't write to sd)
It a big probleam if google do it. but LG & S4 & Note 3 have SD what should they do with no ROOT?
what about this?
http://www.instructables.com/id/How-to-bypass-Android-44-KitKat-external-SD-write-/
nope he wants something else
u1988 said:
If he has root this will help:
https://play.google.com/store/apps/details?id=nextapp.sdfix
=
http://technofaq.org/posts/2014/04/fixing-external-sd-card-write-issue-on-android-kitkat/
I must have root to fix the SD problems ? (can't write to sd)
It a big probleam if google do it. but LG & S4 & Note 3 have SD what should they do with no ROOT?
what about this?
http://www.instructables.com/id/How-to-bypass-Android-44-KitKat-external-SD-write-/
Click to expand...
Click to collapse
you got it completely wrong, he wants something else.
@SidDev said:
you got it completely wrong, he wants something else.
Click to expand...
Click to collapse
Oh sorry! :cyclops:
u1988 said:
Oh sorry! :cyclops:
Click to expand...
Click to collapse
no problem buddy.
and what was the answer???!!!

Categories

Resources