0

I have a rooted Samsung S4 mini(Android 4.4.4), I noted that there are certain files/folders(for example /dev) that when I delete them they come back when I reboot the phone. Why? Is it possible to delete them permanently?

I know that this is very risky and may brick my phone, but:

  1. I'm very curious about this.
  2. It is my guinea pig device.
  3. I can re-flash it(I did it several times ;-)).
2

While GiantTree explained parts of the folder structure, he missed one "mount point": / aka "the root file system". This is created on boot, from contents of the "boot image" – which is a so-called "initial RAM disk" or, in short, Initrd. As it's created from the very same source at each boot, you can delete the stuff as often as you want – it will always return (until you "accidentally" delete that boot image itself – and are lost if you don't have a backup). Only after that, the other file systems are mounted – which GiantTree listed a few examples from (more details e.g. in my answer here).


Let me add an urgent warning: Never touch what you don't know what it's for (delete the wrong thing, and your device no longer starts up). Always create a good (see e.g. ) before you start "playing" with system files. Far too many people end up here with having things deleted and not being able to get them back: without a proper backup, you can have a very hard time (especially with an exotic device that has no ROMs for download anywhere).

  • 1
    You are right, I missed rootfs. I had this feeling that I missed something but I wasn't sure how the root actually behaves. Thanks for clearing that up. – GiantTree May 26 '17 at 16:16
  • @GiantTree Anytime! We had that initrd stuff before – so additional details can be found in those other posts (skip the "user" part to double the number :) – Izzy May 26 '17 at 16:53
1

Android is based on Linux, so it inherits much of the folder structure.

Using the command mount, you can find out what partitions are mounted in Android and what their respective types are.
I will go over a few important ones.

  • /cache: This directory hold the cache partition. Deleting it won't do much bad, the cache just needs to be rebuild.
  • /data: This holds your data partition. Deleting it (or anything within in) might result in errors, apps crashing or general loss of data.
  • /system: This holds your system partition. Deleting it or anything within it (if possible) might result in your device being incapable to boot successfully.
  • /dev: This holds device information. It is created upon boot and can be thought of as a volatile or virtual partition. Files there are usually not removable and not saved.
  • /efs: This partition holds your IMEI and other info. While it shouldn't be writable, some circumstances might lead to it being cleared. Your IMEI will then be reset to 0 and you can't connect to any mobile network. BEWARE WHEN DOING ANYTHING WITH THIS PARTITION.
  • /proc: This partition holds process information and is, like /dev, recreated on boot. Here, however, some files are removable and might lead to processes crashing or locking up. There is no need to do anything in here.

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.