[Q] Prevent wipe of /cache permanently - G1 Android Development

Hi,
I've tried searching but can only find topics relating to dalvik-cache, this is not what I'm looking for.
I need a way of making sure /cache is never wiped. Is there a script or a hack to force Android to never wipe this directory?
I'm running CM6.1
Thank you!

Related

[Q] Checklist before selling Infinity

Hi everyone,
I have been thinking of selling my Infinity but I need some confirmation in some things with regards to wiping the device clean.
I am currently running the latest CROMI-X. So what I wanted to do is wipe everything in my internal storage (all the datas or any kind of prints that shows my usage) and then flash back the latest CROMI-X.
So a couple of things in wipe. I am using TWRP 2.5 as of the moment. So if I wanted to achieve the one I mentioned above which kind of wipe should I do?
If I go to Advanced Wipe: I can see that Dalvik Cache, System, cache, Data and Micro SDcard is present there... If I go ahead and check all of these (except for the Micro SD Card) I believe that I this would also delete the OS itself. Am I correct? If this does it, will I still be able to install a ROM for my infinity? There's also the option of Format Data,which I think wipes clean my internal storage (pictures, videos, etc). This won't affect the System, right?
If you guys have a better suggestion on how to actually do this, please let me know as well. I apologize if there's a lot of question here... I just wanted to make sure that I am doing this right as I don't want to brick my device before actually selling it. Thanks.
To delete all user data, format /data. This automatically includes dalvik-cache and /data/media aka /sdcard. You don't need to format /system as it contains only the ROM.
If you are paranoid that a potential buyer could use "undelete" tools and piece together fragments of your data on the block level, then before formatting /data, you can completely overwrite the data partition from the recovery with the following command (in the "advanced" menu or via adb shell): "dd if=/dev/zero of=/dev/block/mmcblk0p8 bs=256k".

Wiping Cache/Dalvik/Data

I'm wanting to write some edify code to wipe data, dalvik and cache. I think i've got the right idea for data and dalvik, but I'm not certain on cache.
Here's my following code for data and dalvik wipe. Is this the standard for wiping data? Do i need to delete everything from data and not just in the app directory?
Code:
mount("ext4", "EMMC", "/dev/block/mmcblk0p37", "/data");
delete_recursive("/data/app");
delete_recursive("/data/dalvik-cache");
unmount("/data");
Also, i'm going to assume i can mount the cache, but i didn't know the block to mount it.
Any help would be greatly appreciated.
Edit: Thanks to this post, i was able to figure out the block i needed for cache. I would still like to know if this is the proper way of "wiping" the data, cache or dalvik-cache. Should i be formatting instead?
I'm not very familiar with edify, so I may be wrong, however I'll try to help by pointing some issues you may find when investigating this subject.
First look on the code above ... In general, it seems to be ok. Btw I can see that you are not trying to wipe /data but /data/app only...
To fully wipe data partition you shall run delete_recursive("/data"); and after that no additional dalvik-cache wipe will be necessary, as it lies on data so it will be deleted along with it.
Instead of recursive files deletion you may try format command or even some variation of mke2fs... it will create completely new filesystem instead of performing large amounts of delete i/o operations on the old one, along with not deleting filesystem stats, etc.
Hovewer, you have to know that running delete_recursive("/data"); or even format("/data") or something similiar seems to be not the best idea - be aware that real location of files from /sdcard is /data/media which is then bound with FUSE driver to /sdcard during the boot, so it acts like an sd memory BUT it still lies along with all your "regular" data files on /data partition. Doing such a recursive deletion will result in losing not only files from /data, but also from /data/media = /sdcard, which is probably not the thing we want to happen ;]
You may want to figure out how to avoid this, as you may lose the data which you didn't want to lose (for example: nandroid backups, if you keep them on /sdcard)! I personally don't know the exact solution and don't have time and possibility to figure it out at the moment
Also, please be aware that Android has the "wipe" command built-in, put "wipe" in terminal emulator to find out the syntax. I am not sure but it may avoid the sdcard when wiping automatically, as it is native android tool and it may be adapted for Android's file stricture.
Last but not least, you can find out device-partition pairs by inputting such a command via terminal or adb shell (seeking for a device name which is mounted as /cache in example below):
Code:
cat /proc/mounts | grep cache
esgie said:
I'm not very familiar with edify, so I may be wrong, however I'll try to help by pointing some issues you may find when investigating this subject.
First look on the code above ... In general, it seems to be ok. Btw I can see that you are not trying to wipe /data but /data/app only...
To fully wipe data partition you shall run delete_recursive("/data"); and after that no additional dalvik-cache wipe will be necessary, as it lies on data so it will be deleted along with it.
Instead of recursive files deletion you may try format command or even some variation of mke2fs... it will create completely new filesystem instead of performing large amounts of delete i/o operations on the old one, along with not deleting filesystem stats, etc.
Hovewer, you have to know that running delete_recursive("/data"); or even format("/data") or something similiar seems to be not the best idea - be aware that real location of files from /sdcard is /data/media which is then bound with FUSE driver to /sdcard during the boot, so it acts like an sd memory BUT it still lies along with all your "regular" data files on /data partition. Doing such a recursive deletion will result in losing not only files from /data, but also from /data/media = /sdcard, which is probably not the thing we want to happen ;]
You may want to figure out how to avoid this, as you may lose the data which you didn't want to lose (for example: nandroid backups, if you keep them on /sdcard)! I personally don't know the exact solution and don't have time and possibility to figure it out at the moment
Also, please be aware that Android has the "wipe" command built-in, put "wipe" in terminal emulator to find out the syntax. I am not sure but it may avoid the sdcard when wiping automatically, as it is native android tool and it may be adapted for Android's file stricture.
Last but not least, you can find out device-partition pairs by inputting such a command via terminal or adb shell (seeking for a device name which is mounted as /cache in example below):
Code:
cat /proc/mounts | grep cache
Click to expand...
Click to collapse
Thanks a bunch! I didn't even think about the sdcard getting wiped...
=Death259;48255914]Thanks a bunch! I didn't even think about the sdcard getting wiped...
Click to expand...
Click to collapse
What you can do is extract and call a bash script and recursively remove all content from /data excliding the media folder (sdcard)
Also dalvik is in /data already so wiping data automatically wipes dalvik

[Completed] [Q] Help with CWM partitions

Hey guys, i'm running CWM recovery v6.0.4.7. In the recovery, i see many partitions under 'Mounts and storage' like:-
/boot
/system
/cache
/data
/persist
/firmware
/sns
/data and /data/media (/sd card)
Would someone care to explain what's inside these partitions and what are the risks if i format them ? Also can someone explain which all partitions are changed when i flash a ROM/kernel etc ?? Thankyou :good:
Hi there,
This thread here ( [REF] CWM - Clockworkmode menu options & Partitions– GENERAL KNOWLEDGE) gives you a lot of the information you are looking for. Though this is in the S2 section the principles are all the same so you can ask questions in that thread.
NO hope there
That thread was last updated in May. And i only want to know about /persist, /firmware, /sns more importantly, which i searched everywhere but could'nt find. Any help would be appreciated
SpaceMonkeyK9 said:
That thread was last updated in May. And i only want to know about /persist, /firmware, /sns more importantly, which i searched everywhere but could'nt find. Any help would be appreciated
Click to expand...
Click to collapse
I would suggest asking in the thread linked above.
Also asking here may be useful: Android Q&A, Help & Troubleshooting
Please keep in mind also that the partitions you are talking about are extremely important to the device, messing with these areas could lead to irreversible damage.
Yes i do understand that these partitions are vital for the proper functioning of my phone. But i would love to know which all partitions are changed when i flash a ROM. For eg: I formatted /boot partition once, but flashing a custom ROM immediately restored the necessary files and i was up and running again. Only later did i discover while reading a post that /boot partition consisted of the kernel and the RAMDISK, which is included in every ROM zip file.
Thank you and thread closed!

F2FS on Lollipop

I was able to convert /data to F2FS and flash EX kernel. That boots and runs fine, but I converted cache to F2FS and it won't boot. I'd also love to convert /system as well, but as far as I understand that takes a custom ROM. Anyone else have any experience with F2FS on 5.0?
Bumps
Not on 5, no. But cache and system are of little or no benefit anyway. IMHO only /data needs to be f2fs. It improves read/writes on flash memory but you're not really doing that on /system (and some extent, /cache) as you are with /data.
Hu? You read/write from cache, system, and data all the time! Lots of google apps are system apps, obviously /data is everything else and cache gets used by both!
bobloadmire said:
Hu? You read/write from cache, system, and data all the time! Lots of google apps are system apps, obviously /data is everything else and cache gets used by both!
Click to expand...
Click to collapse
System? Absolutely not. You Never write and it is rare that you read too.
Cache is hardly used. If you look in there.
Ah yes you wre right about system, though you still do a lot of read from it. I'm under the impression that cache actually can get hammered as hard as /data because every app launch pulls cache.
bobloadmire said:
Ah yes you wre right about system, though you still do a lot of read from it. I'm under the impression that cache actually can get hammered as hard as /data because every app launch pulls cache.
Click to expand...
Click to collapse
App cache is on /data. /cache is primarily used for play downloads
Really? Well I'm learning a lot today. Why is a play store cache it on a separate partition?
bobloadmire said:
Really? Well I'm learning a lot today. Why is a play store cache it on a separate partition?
Click to expand...
Click to collapse
It just downloads the apk there until it is installed. Just to keep it tidy
gotcha. So if we convert /system to F2FS that will help things like boot, system apps etc, I'm assuming. Resume from sleep?
bobloadmire said:
gotcha. So if we convert /system to F2FS that will help things like boot, system apps etc, I'm assuming. Resume from sleep?
Click to expand...
Click to collapse
Boot maybe. Systems apps, debatable. Negligible if any. Data is where the payload is.

Wipe /system remove fingerprints?

Hi everyone, I'm not sure if I'm posting in the right place, so forgive me if I'm in the wrong place.
The title says it all: Does wiping the /system partition remove my fingerprints? I'm running lineage 18.1, I'm experiencing the battery draining very quickly, so I wanted to try a GApps that allows me to optimize Google services, I'm using MindTheGapps (Recommended by LineageOS), but I saw that NikkGapps allows me to do what I want, so I would like to test it, but I don't want to do it on top of another gapps, so I would clean /system.
But I share my fingerprint with my girlfriend, and re-enrolling her fingerprint is boring. So I wanted to know if the wipe in /system would erase the prints, or can I do it with peace of mind?
Thank's
Princknoby said:
Hi everyone, I'm not sure if I'm posting in the right place, so forgive me if I'm in the wrong place.
The title says it all: Does wiping the /system partition remove my fingerprints? I'm running lineage 18.1, I'm experiencing the battery draining very quickly, so I wanted to try a GApps that allows me to optimize Google services, I'm using MindTheGapps (Recommended by LineageOS), but I saw that NikkGapps allows me to do what I want, so I would like to test it, but I don't want to do it on top of another gapps, so I would clean /system.
But I share my fingerprint with my girlfriend, and re-enrolling her fingerprint is boring. So I wanted to know if the wipe in /system would erase the prints, or can I do it with peace of mind?
Thank's
Click to expand...
Click to collapse
No, wiping system partition doesn't wipe stored fingerprints because they are stored in the data partition. When flashing ROMs, wiping data partition(factory reset) is required unless you are flashing an updated version of a ROM that you already have installed, such as having LineageOS installed and then updating to a newer version of LineageOS, you can just flash the new ROM without having to wipe anything.
Hi, unfortunately I couldn't test if it would work... I wiped /system /dalvik /cache, installed ROM and GApps, but was unable to boot, stuck in bootloop, forced to format /data partition Anyway, thanks for your time!

Categories

Resources