[Q] what is /cache and /system ? - Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A

could anyone give me a clear explanation about swap. i found the term /cache and /system. i do not find any clear explanation about where the swap process takes places.
if i use swap2cache script, will the swap happen at sdcard or internal memory?
sory for noob question.

sony_84 said:
could anyone give me a clear explanation about swap. i found the term /cache and /system. i do not find any clear explanation about where the swap process takes places.
if i use swap2cache script, will the swap happen at sdcard or internal memory?
sory for noob question.
Click to expand...
Click to collapse
Swapping:
When the ram has very less free space the operating system moves the low priority processes from the ram and places them in the swap partition to make space for high priority processes .
When those low priority processes attain high priority the operating system moves that process from swap partition and places it in the ram.
This process of moving files to and from ram is defined as swapping and the partition which is used for storing these swapped files is the swap partition.
/cache is a partition which is utilized by programs. Programs place their files which are routinely used in the cache partition to reduce the processing time.
For example:
Gallery app saves all the thumbnails of all the pics and videos in the cache partition for fast access when the app is opened.
/system is the partition where all the operating system files are placed . This partition contains nothing but the files which are needed for the operating system to perform without any intervention by the user (both cache and system are generally write protected).
For example:
The folder C:\windows is the system folder in windows whereas /system is the system partition in android.
When you use the /cache partition for swap space you are using the phone memory and not the external memory.
you might want to google the term "zram" it is some what faster than swap to cache,
it compresses the ram memory and makes way for new processes and when the compressed memory is needed again, it simply uncompress them right in the ram memory. as it works with the ram memory itself it is considered to be the fastest.
(please correct me if I am wrong)
And don't be sorry for a noob question. Every experienced developer must have started as a noob and we are here to learn and share so questions are always welcome!
PRESS THANKS IF I HELPED YOU!
sent from my smultron

gouthamthemostwanted said:
When the ram has very less free space the operating system moves the low priority processes from the ram and places them in the swap partition to make space for high priority processes .
When those low priority processes attain high priority the operating system moves that process from swap partition and places it in the ram.
/cache is a partition which is utilized by programs. Programs place their files which are routinely used in the cache partition to reduce the processing time.
/system is the partition where all the operating system files are placed . This partition is nothing but the files which are needed for the operating system to perform without any intervention by the user (both cache and system are generally write protected).
When you use the /cache partition for swap space you are using the phone memory and not the external memory.
you might want to google the term "zram" it is some what faster than swap to cache,
it compresses the ram memory and makes way for new processes when the compressed memory is needed again it simply uncompress them right in the ram memory. as it works with the ram memory itself it is considered to be the fastest.
(please correct me if I am wrong)
PRESS THANKS IF I HELPED YOU!
sent from my smultron
Click to expand...
Click to collapse
great explanation brother, the only bad swap, in which damages the lifetime of sd memory, I remember when I used my old w8 swap took longer to copy files from PC to phone and vice versa, so I do not recommend doing swap is my simple opinion :highfive:

Swapping to external memory is never recommended unless you badly need swap partition and it's the only option you have. Swapping to external memory reduces the life of the external memory very quickly since swapping pages to and from external memory increases the number of read/write cycle count of the external memory which is a very important factor in the external memory's life.
PRESS THANKS IF I HELPED YOU!
sent from my smultron

gouthamthemostwanted said:
Swapping to external memory is never recommended unless you badly need swap partition and it's the only option you have. Swapping to external memory reduces the life of the external memory very quickly since swapping pages to and from external memory increases the number of read/write cycle count of the external memory which is a very important factor in the external memory's life.
PRESS THANKS IF I HELPED YOU!
sent from my smultron
Click to expand...
Click to collapse
so, when we use swap to /cache or /system , will it reduce the life of our internal memory ?? it means that it will break our gadget someday

sony_84 said:
so, when we use swap to /cache or /system , will it reduce the life of our internal memory ?? it means that it will break our gadget someday
Click to expand...
Click to collapse
Theoretically yes,
It depends on how often the swapping takes place and practically in very extremely rare cases the internal memory fails due to swapping. (someone correct me if I am wrong)
External memory is designed in a way to have large space so it's transfer speed is the lowest.
Internal memory is embedded flash memory and has lower capacity compared to external memory and it has higher transfer speeds compared to external memory.
Ram is volatile memory designed for high speed data transfer.
If you are very much concerned about your life of external memory and internal memory then zram is your only option.
PRESS THANKS IF I HELPED YOU!
sent from my smultron

gouthamthemostwanted said:
Theoretically yes,
It depends on how often the swapping takes place and practically in very extremely rare cases the internal memory fails due to swapping. (someone correct me if I am wrong)
External memory is designed in a way to have large space so it's transfer speed is the lowest.
Internal memory is embedded flash memory and has lower capacity compared to external memory and it has higher transfer speeds compared to external memory.
Ram is volatile memory designed for high speed data transfer.
If you are very much concerned about your life of external memory and internal memory then zram is your only option.
PRESS THANKS IF I HELPED YOU!
sent from my smultron
Click to expand...
Click to collapse
if it's so , I just need to apply zram script ?

sony_84 said:
if it's so , I just need to apply zram script ?
Click to expand...
Click to collapse
yes.
this is the script to be executed to enable zram.
i guess it should work with all kernels for our device (i guess)
i took it from rage kernel thread thread so the credits goes to DuMOHsmol
the script must be run at boot every time (copy it to etc/init.d folder)(provided you have init.d support).
HIT THANKS IF I HELPED YOU!

gouthamthemostwanted said:
yes.
this is the script to be executed to enable zram.
i guess it should work with all kernels for our device (i guess)
i took it from rage kernel thread thread so the credits goes to DuMOHsmol
the script must be run at boot every time (copy it to etc/init.d folder)(provided you have init.d support).
HIT THANKS IF I HELPED YOU!
Click to expand...
Click to collapse
this is working great.
just to make sure, is this safe for internal and external memory??

Ya man! Nothing to worry. The main concept behind zram is to optimize the ram memory for system on chip devices (devices whose hardware can't be upgraded).
PRESS THANKS IF I HELPED YOU!
sent from my smultron

Related

Linux-Swap without App2SD???

Hi everyone,
A relatively noob question here.
I am running the Official ROM 2.76.405.5 on an unbranded Hero, and want to give Linux-Swap a try. But I don't want Apps2SD; I might move certain apps cache to the SD after rooting, but like the Apps themselve on the internal memory though. How can I go about it? What do I need to do?
1) Can I format my SD card so that it has a fat32 and a linux-swap partition but NO "ext" partition?
2) If I do make an EXT partition, what patch/fix should I do to make only swapping work, without Apps2SD? Modaco's Hero patch as well as his custom ROMs come with Apps2SD. Is there a way to get rid of it?
3) Will I need "busybox" to make swapping work? Or is "Swapper" alone going to be enough?
4) If I make my custom update.zip file from Modaco's Hero patch.zip, from which I delete A2SD, and then falsh that update.zip via the recovery mode, will it work?
5) And what swap size do you recommend? Some people use as large as 256MB... while the default in most cases is 32MB. Is the larger the better?
Please help a non-developer here. Many thanks in advance!
OK, I have done it and it seems right. I made all three partitions (fat32, ext3, and linux-swap) and then pushed busybox by Modaco's method via "adb shell". That means I have the ext3 partition but no Apps2SD, so my apps would stay on the internal memory. Am I right?
Now I have also installed Swapper and so far it has not given me any error. Via Advanced settings, I have told it to use Swap "partition" instead on swap file. My swap partition is 256MB
My questions now are:
1) If I kill swapper by taskkiller, will swapping end?
2) How much swappiness should I choose?
3) How do I know that it is working and what improvements should I expect to see? How can I test that my phone is functioning faster??
Please reply
Would anyone like to share their comments on this, please?!?
One more thing, Hero comes with a 288MB RAM, but the total available system memory (RAM) shown by Swapper app is 197MB. Why such discrepancy??
Your views will be much appreciated!
Very well asked questions. Some masters respond to them please so we don't disturb you about these questions within every thread of yours
to format your sdcard (i'm assuming you know how to use parted and have only 1 partition) resize your fat32 partition, for example, with my 7948 MB sdcard:
Code:
(parted) resize 1 0 7850 (where 7850 is the maximum size of your sd-card minus the amount you wish to allocate for swap, in this case, 98 MB)
wait for it to finish re-sizing, doing it this way prevents data loss, after it's done;
Code:
(parted) mkpartfs primary linux-swap 7850 7900
(parted) mkpartfs primary linux-swap 7900 7948
(parted) rm 2
(parted) resize 3 7850 7948
(parted) quit
you basically create two linux-swap partitions (the second partition can be anything, but I use linux-swap because it can be any size in MB) so that the third one gets asigned a p# of 3, then remove the second one, and then resize the third one to take up the whole space left after your fat 32 partition, that way you don't waste any space. You can always
Code:
(parted) print
to make sure your fat 32 partition has a p# of 1 and your linux-swap has a p# of 3
About why there's only 197MB left on your device? Radio and GPU take the other 96 MB and the system has no access to that memory. Don't worry, it's still enough for you to run hero, pity us dream users with only 96 MB working RAM.
===edit====(answer more questions)
If by "official rom 2.73.405.5" you mean the one you can download from MoDaCo, then I don't even think it has root. There are four 2.73.405.5 roms there, the RUU, which you should avoid like the plague, the Official one which is only the RUU but packaged in OTA format, the Official one with Radio update, and the Official rooted one. You wan't to use the rooted one. Also, you do need busybox (you're already done it). I think that in the official rooted there are no scripts running at boot, so you won't get A2SD forced upon you (always a good thing, soon as I buy my Hero I'm using that build too as a base for my build), no compcache, no swap-file usage, nothing, just a stock rom with root. Anyway, you already have busybox, and that's all swapper requires, so you're good. For extra credit, you could learn how to unpack boot.img and edit the init.rc to call on your own script from bin and have it do swap automagically instead of using swapper (plus you can do nifty things like using mmcblk0p2 instead of p3, among other things).
I don't know how swapper works exactly, but I think all it does is echo settings to the VM to set up swap, so killing the app should do nothing (it's just a front-end to what other roms do automatically) and swap should stay working after you kill it. You can try, just kill the app and then open up the terminal and type
Code:
$su
# busybox free
that will tell you how much memory you have and how much swap you have, you should still have swap even after killing swapper.
About swap size?... depends who you ask. If you ask me, you have a hero with 198 MB working ram and you shouldn't even have to bother with swap at all. If you still want to, maybe try to set up a 32 MB compcache setup (you have enough ram where compcache makes sense) with a swappiness of 0 (this keeps the memory pages for Rosie in swap and even after heavy usage, you can always go back to rosie w/o reloads).
Having a swap-file on your sdcard makes no sense if you don't have a class 6 sdcard as it will hurt performance, so, if you do, anywhere between 64 MB and 198 MB (to match the whole working memory space of the device) with a swappiness of 60 should suffice.
I wish I had a hero...
Thanks jubeh, thanks soo much. It was really helpful After reading your answer, I completely understand how to make only fat32 and linux-swap partitions and save space by not having an ext3.
I am afraid I don't quite understand the compcache thing; I think I have to do more reading/homework on this before I ask further questions
I did install the Official ROM which I downloaded from HTC website as an RUU >> flashed Amon_RA's recovery image via flashrec >> rooted by pushing "su" and "Superuser.apk" via ADB shell, and then also pushed Busybox (from Modaco's 2.2 ROM, I think it is version 1.5.1).
I am using a Sandisk 8GB class 6 card... it is fine so far (except the photo thumbnails not being generated in the ".thumbnails" forlder, but that's a different story). I have noticed that after the ROM upgrade, a folder called "rosie_scroll" get automatically created on the SD card... may be it's a kind of built-in swap?!?! Am not too sure.
Moreover, at the moment, I have set swappiness to 60. When most of the apps are open, the hero functions quite well but I see that about 190-194MB of the internal memeory is being uesd at times and heavy use and the area of occupied swap partition gradually increases. I think it is because only thise apps will swap which are kind of sleeping or dozing in the background. Am I right?
Just another question, if you unzup MCR 2.2, you see in the xbin folder, a file called "dexopt-wrapper", an addition to busybox. What does it do? Its function?
Will having lots off apps open in the background and swapping them continuosly have a deleterious effect on the battery life??
Thanks again
Best regards.
having many apps open means using ram a lot. if you add swapping, it means not only ram sucking battery, but also reading/wirtting sd, which is pretty much battery sucker itself.
so yes, if you want to lengthen your battery life, keep your apps loaded atst to a minimum.
if what you want is a comparison for battery life between swapping and not swapping.. you should check if you have your phone always on or off and some other factors (keeping ram alive in hibernation mode wastes more battery than static sd memory, ie).
Thanks sik_gerar I understand where you are coming from.

[Q] A2SD, TiBu, Nandroid and You...

Hoping someone can help me understand the implications of using the above methods of backup as it relates to device performance and restore.
First is a question about how Android memory works. I'm running Virtuous Unity 2.39 on an Inspire. According to TiBu my System ROM is 575MB with 40.4MB free, 1.21GB internal with 648 free. The system memory manager says I have 180MB of memory available. So, I'm not sure which memory is which. What's used for storage, and what's used for runtime of programs? Am I correct to assume that if I move programs from internal memory to storage that I'll be able to run more apps at any given time?
Here are my questions.
Will moving some (larger) apps like CoPilot (33MB), Documents2Go (11MB), SPB Wallet (12MB) and infrequently used utilities like SpeedTest benefit the handset performance in any real way, or am I over-thinking this?
If the answer to the above is 'yes', there is a performance gain, what happens when I do a Nandroid or TiBu backup in preparation for a ROM upgrade? I know that TiBu has the setting 'Restore backups to... Original Location' as one of the options. Does this mean I could theoretically restore apps to an entirely new (blank) card if need be?
Will using a utility like D2SD (if I partition my card with an EXT4 segment) likewise help in any substantial way?
How can I help organize the apps and data on the card so that it reduces 'clutter' and presents a more easily managed folder structure to find things that I need?
Thanks in advance for your help!
Anyone out there have thoughts on this?
The system ROM, is the memory used by the custom rom. It stores all the files the rom needs to run. The internal memory is the memory used for storage by all the apps, etc. you have. The 180mb you had free, is the RAM. You'll notice it'll be at different amounts (depending on how many things are running, and how resource consuming the are).
1. Yes, but only if your internal memory is very low (low enough to get the "low space" warning (or at least close to that).
2. No (not fully). Some may be restored fine but some would be corrupted.
3. Only if your device's internal memory (in total) is low.
4. Usually when you move an app to the SD card, they automatically organize themselves in one folder called ".android_secure"
Hope this clarifies some things for you .
Theonew said:
The 180mb you had free, is the RAM. You'll notice it'll be at different amounts (depending on how many things are running, and how resource consuming the are).
Click to expand...
Click to collapse
I appreciate your reply.
So, there wouldn't be any performance improvement if I were to free up more RAM or perhaps create an EXT4 partition on the SD card for system use?
BillTheCat said:
I appreciate your reply.
So, there wouldn't be any performance improvement if I were to free up more RAM or perhaps create an EXT4 partition on the SD card for system use?
Click to expand...
Click to collapse
Yes there will be a performance gain if you free up RAM but creating an EXT4 partition does not contribute to that. That partition will only be for storage.

[Q] Actual hardware configuration and what we see in real

Hello anybody who can help me and other people understanding what we see in applications which show memory info.
I want to understand why "meminfo" shows total RAM 335Mb and Internal phone storage: 420Mb (it is on my phone).
Official info from http://developer.sonyericsson.com/wportal/devworld/phones/phone-overview/xperia-mini-pro?cc=gb&lc=en says it should be the next:
- Internal phone storage: up to 320 MB
- RAM: 512MB !!!
One of my thoughts is that the part of memory is used by video-card
Please explain me why it happens
Some is dedicated to the graphic and some more is reserved from the system. The total is 512, don't worry.
Sent from my SK17i using XDA App
Think of the Android Operating System as a Virtual Machine on your phone. It needs some RAM in order to work.
dumraden said:
Think of the Android Operating System as a Virtual Machine on your phone. It needs some RAM in order to work.
Click to expand...
Click to collapse
Can you modify the values besides a VM usage ram ?
No. What you need in order to have more "system memory" which actually is part of the RAM itself is swap. Swap creates a partition on your sd card which then is used by the system to store temporary data. The thing is that its a double edged knife. NAND is 100 times faster than your typical SD card, so loading apps and/or part of the system on your swap partition might end up in a slower overall phone. But we wont have such a problem with our devices, because the system itself doesnt take all that much storage itself.
The only device so far that i know, which had a problem with storage was the Desire Z i own, when you wanted to flash a custom sense 3.0 rom. Then it needed different partitioning in order for the Sense 3.0 to fit into the device.(the device isnt a sense 3.0 device by default).
If you have many apps that you cant seem to fit in the 320mb of free memory, i recommend you install an app2sd application.

This is normal on internal memory of SGS3? This happens on Stok 4.1 roms??

I have a big problem if it is not normal or not, I just installed the rom based on android 4.1 (omega rom), did a full wipe, even format the internal storage was empty now, but for some reason there are 500 mb that are being used by a hidden folder called:'' system data'', which can not be deleted and also missing from Windows Explorer.
Is this normal? I would also like to clarify that the size of this ''folder'' for some reason is growing
And it will grow with any apk you'll install.
spamtrash said:
And it will grow with any apk you'll install.
Click to expand...
Click to collapse
Thanks for the comment, then it is normal that in the phone's internal memory truth (which supposedly is 16GB)?
I do not understand is why they are there if i format the internal memory from recovery.
UP, please help me!! apparently this space: ''system data'' increases more and more for every application that installed, this means that applications are installed on internal memory space?
That 500MB is a partition on the sd card for.....you guessed it......system data.....note in the picture you took there is currently nothing in that partition
slaphead20 said:
That 500MB is a partition on the sd card for.....you guessed it......system data.....note in the picture you took there is currently nothing in that partition
Click to expand...
Click to collapse
But if a partition, its size should not be still? because it increases and decreases in size?
Why is it then that partition increases when installing an app? and if uninstall the volume decreases ... assumes that applications are installed in "/ data/app" then that is what takes up space?
updates
any??

[TIP] Defrag phone storage

Hello Everyone !
Last week i was trying different ways to mount our phone storage ( internal as well as card ). What im about to share is the result of some experiments done at that time.
This is not a guide exactly, as many of us know the steps done here, but still, i take no responsibility of any type of problem you face.Please ask for help if you need.
for more information : Read this.
When i checked my internal storage, it was 72% fragmented !!!
so i thought may be there are others who haven't formatted internal/external storage for a year or above, thus leading to heavy fragmentation.
here it is :
method 1: (also applicable for card storage)
take backup of all data and format. That should solve it !
method 2:
i recommend using 360 security app(with root access) first.
let the app scan your phone, it will find app cache, trash and user data in your phone. but first uninstall unused apps and delete some data that you don't need. you can always copy it back if you need it.
clean all, including empty folders (it will increase simplicity of your storage).
How to Mount Internal Storage as USB DRIVE :
1. Reboot into CWM
2. Connect phone to a windows PC (prefer win 7)
3. Go to "USB mass storage"
4. Select mount sd card.
5. You should see your internal mounted as removable mass storage drive.
6. Enjoy unrestricted access to your internal drive.
--------------------------------------
All right guys, i dont know much about the ssd, but if it is not necessary (even at > 50% of frag-level ), please tell me.
Thank you !
And here I am, thinking that we are using the EXT file system. :|
at least Samsung uses ext4, i think Sony does that too ...
DigitalDreamer said:
And here I am, thinking that we are using the EXT file system. :|
Click to expand...
Click to collapse
deshx said:
at least Samsung uses ext4, i think Sony does that too ...
Click to expand...
Click to collapse
Samsung uses their own filesystem in the newer devices.
And I think Sony uses ext4. But the thing is why would we need defragmentation if it's ext4. The files aren't accessed as in windows. Of course that windows will find disk errors and that there is a need if defrag. But the way Linux works, do we really need that?
file access is not the issue. i think the way ext4 manages writes makes all the difference.
ext3/ext4 avoid fragmentation of data and the way they store data, they can easily manage new read/writes without decreasing performance.
but even ext4 gets some issues, i found after some googling that when free space is less than ~15%, ext4 does not get enough room to swap things around. that fragments the drive heavily, thus the issues.
in that case, defragmenting might do some good.
DigitalDreamer said:
Samsung uses their own filesystem in the newer devices.
And I think Sony uses ext4. But the thing is why would we need defragmentation if it's ext4. The files aren't accessed as in windows. Of course that windows will find disk errors and that there is a need if defrag. But the way Linux works, do we really need that?
Click to expand...
Click to collapse
deshx said:
file access is not the issue. i think the way ext4 manages writes makes all the difference.
ext3/ext4 avoid fragmentation of data and the way they store data, they can easily manage new read/writes without decreasing performance.
but even ext4 gets some issues, i found after some googling that when free space is less than ~15%, ext4 does not get enough room to swap things around. that fragments the drive heavily, thus the issues.
in that case, defragmenting might do some good.
Click to expand...
Click to collapse
Oh yeah, on low space. Well on my U from 4GB I usually have around 2.5GB free so I guess I'm safe for now.
Btw the fragmentation usually shows losing performance when accessing libs and stuff. But that doesn't apply to us.
i had only 500mb free some time ago, so i did defrag the internal at that time(72% fragmentation), but now i have 3 gb free ! :highfive: .so its same for me ...no need !
DigitalDreamer said:
Oh yeah, on low space. Well on my U from 4GB I usually have around 2.5GB free so I guess I'm safe for now.
Btw the fragmentation usually shows losing performance when accessing libs and stuff. But that doesn't apply to us.
Click to expand...
Click to collapse
Internal storage (/sdcard) uses FAT32 file system, the data partition uses ext4 file system.
I know that defragmenting a flash drive is useful only to cause more wear and tear.
Are you all insane? You can't defragment flash drives!
That slows it down and eventually will ruin it.
Sent from Hacker's U on CM11 Weekly
If sdcard uses fat32, then it should be defragmented....otherwise its fine...
One doubt though, internal is named sdcard too....
You mean external storage, right?
HandyMenny said:
Internal storage (/sdcard) uses FAT32 file system, the data partition uses ext4 file system.
I know that defragmenting a flash drive is useful only to cause more wear and tear.
Click to expand...
Click to collapse
Sent from my ST27i
hackerpower said:
Are you all insane? You can't defragment flash drives!
That slows it down and eventually will ruin it.
Sent from Hacker's U on CM11 Weekly
Click to expand...
Click to collapse
so we shouldn't need to defragment internal or card.... Right?
Well I wasn't aware of this...
Sent from my ST27i
deshx said:
If sdcard uses fat32, then it should be defragmented....otherwise its fine...
One doubt though, internal is named sdcard too....
You mean external storage, right?
Sent from my ST27i
Click to expand...
Click to collapse
Internal storage use FAT32 filesystem, external storage use FAT/FAT32/exFAT.
Both are flash drives and shouldn't be defragmented.

Categories

Resources