0

I think this might be a simple question but this been bugging me for long,

Why is that when i do a ClockWorkMod wipe of /data, the /data/media folder stays intact. @beeshyams pointed out that it is to avoid wiping out any clockworkmod backups. If that is the case, only /data/media/clockworkmod/ folder will stay untouched if backups exists or not. But rather the whole /data/media/ folder is kept safe from harms way. A better explanation will be appreciated.

  • To keep backups safe. See this android.stackexchange.com/a/132271/131553 – beeshyams Feb 12 '16 at 12:30
  • How exactly is two different questions a "duplicate". its like asking what is 8/2 and someone says its a duplicate question of asking what is 2+2 cause they both answer 4. – Light93 Feb 12 '16 at 15:05
  • @beeshyams edited the question appropriately addressing your opinion about it and why i find it not right. – Light93 Feb 12 '16 at 15:31
2

Please note the following are assumptions based on my Linux knowledge. So I cannot 100% back them, especially cannot tell if any/all recoveries work this way.

First, some raw facts:

  • as already pointed out, /data/media is a symlink to the SD card
  • resulting of that, the data behind it reside on a different partition
  • that other partition is usually not included with the wipe/, which normally covers only /data and /cache

So now to the wipe itself. "Emptying" the /data partition could be done in different ways:

  • "formatting" the partition: wouldn't touch the data behind that symlink
  • performing something like rm -rf /data/*: would remove the symlink, but leave the data behind it untouched
  • walking the entire /data/* file by file, directory by directory, removing each entry (no idea why one would do that). In that case, unless the process follows symlinks, again only the symlink would be gone but the content behind it left untouched

So once more: As the data-in-question does not physically reside on the /data partition, it should even be expected to stay.

  • Thank you for the answer and would try to verify other comment and see if it matches. Would take time since CWM for my device is not original and modded and I still don't trust it enough to wipe and check – beeshyams Apr 3 '16 at 8:15
  • Make a complete backup first (Nandroid+SDCard-copy). But even when trying, that won't confirm the "why" but only the "if" ;) – Izzy Apr 3 '16 at 9:30
-2

This thread why doesn't format of /data in recovery blow away all your personal images, music, documents, etc? offers an answer

Quoting Scary Alien, who is a moderator on reddit forum (emphasis mine)

... when the /data partition is requested to be wiped with "wipe_data", the erase_volume (recovery.c) function is invoked. erase_volume invokes format_volume (roots.c). If format_volume determines if the volume in question is /data and /data/media is present and symlinked to /sdcard, then the format_unknown_device (extendedcommands.c) function is invoked. format_unknown_device will then recursively delete all files in /data -- except for those in the /data/media structure

In other words, as clarified in a trailing post

Doing a data wipe in ClockworkMod will skip the /data/media folder (subdirectory)--i.e., where your "SD card" lives...

  • I'm curious here for 2 things: 1) @Firelord what does CyanogenMod code have to do with ClockWorkMod? 2) to beeshyams: if /data/media is a symlink to another partition, one could even "format" /data without the content there being lost. Initializing the device afterwards would restore the symlink – et voila, the content becomes visible again at this place. That would be my explanation – but as I've not checked into the code, I cannot back that claim and hence hesitated to answer. – Izzy Apr 2 '16 at 17:41
  • @izzy: Possible . I can't justify why not and as I said before can't read code either. However, this is the only explanation I found – beeshyams Apr 2 '16 at 19:12
  • Didn't expect you to – just wanted to give an alternative explanation :) And as for CM vs CWM: it might well be recovery uses "ROM code" for that and Firelord wanted to check AOSP. Not having read the linked post I first thought someone had messed up the terms (missed the "W") – but scary alien built his argumentation on CM's recovery (obviously concluding other recoveries would behave the same). Hey, but even an rm -rf /data/* would just remove the symlink but leave the data behind it untouched :) – Izzy Apr 2 '16 at 19:22
  • 1
    @izzy, don't recall in the case of TWRP, where the backups are stored but for CWM it explains why backups are not deleted. That apart, as an ordinary user (= can't read code), explanation seems logical. Verification of ROM/CWM is beyond the scope of this site, right?! . (One could seek validity of a recommended app (proposed in a solution) via code verification !!). – beeshyams Apr 2 '16 at 19:58
  • @izzy- And speculation on possibilities/ veracity does not serve any useful purpose, unless it is followed up and a conclusion presented either way. When left hanging inconclusive, it may needlessly or unintentionally detract the OP (or anyone else reading it) from the solution presented – beeshyams Apr 2 '16 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.