System folders on Android are the real “dark matter” of your smartphone: they take up gigabytes of memory, but rarely come into the user’s field of view. Unlike the application cache or downloads, which are cleared in a couple of clicks, files in /data, /system or /cache require caution: one wrong action can lead to OS malfunctions, data loss, or even bricking of the device.

The problem is complicated by the fact that Android does not provide standard tools for deep cleaning system partitions. Manufacturers (for example Samsung, Xiaomi or Google) restrict access to critical folders to prevent accidental damage. However, over time, temporary files, log files, remnants of deleted applications and duplicate updates accumulate here - all this is “garbage” that can be safely deleted. The main thing is to know which folders should not be touchedwhich ones can be cleared without consequences.

In this guide we will figure out how to analyze the contents of system folders, what tools to use for this (from built-in utilities to ADB commands), and provide a checklist of actions for safe cleaning. You will also learn how to restore the system if something goes wrong - because even with careful work, risks remain.

Why system folders become clogged with garbage

Android is designed in such a way that many processes leave behind “tails” - files that should have been deleted automatically, but for some reason remain. Here are the main sources of garbage:

  • 📱 Remains of deleted applications: even after uninstalling the app, configuration files, databases or caches may remain in folders /data/data or /data/app .
  • 🔄 Duplicate updates: when installing OTA updates the system saves old versions of files in /cache or /data/ota_package in case of a rollback.
  • 📝 Log files and dumps: Android keeps error logs (/data/anr, /data/tombstones), which over time grow to hundreds of megabytes.
  • 🗑️ Temporary files: are created when installing an APK, unpacking archives or working with multimedia (for example, in /data/local/tmp).
  • 🔧 Cache system services: Google Play Services, Android System WebView and other services store a cache in protected folders.

Garbage accumulates especially heavily on devices with custom firmware or after multiple over-the-air updates. For example, the Samsung Galaxy s One UI folder /data/log may contain gigabytes of debugging information if Developer mode was previously enabled. And on Xiaomi with MIUI the folder /data/media/0/MIUI is often bloated due to duplicate themes and wallpapers.

⚠️ Attention: On some devices (for example, Huawei s EMUI or Oppo s ColorOSs), manufacturers block access to system folders even through ADB.Attempt to modify them may trigger anti-rollback protection and lead to the bootloader being locked.

Which system folders can be cleaned and which cannot be

Before you start cleaning, remember the golden rule: all folders in. section /system It is forbidden to touch. This is the core of the operating system, and any changes here require rights root and deep knowledge. But in other sections there is something to clean:

Folder Is it possible to clean What is stored Risks
/cache ✅ Yes Temporary update files, recovery cache Low. After cleaning, the first boot of the system may slow down.
/data/local/tmp ✅ Yes Temporary files of the APK installer and system processes Possible. errors when installing applications before rebooting.
/data/log ✅ Yes (partially) System and application log files Medium. Deleting active logs can complicate error diagnosis.
/data/dalvik-cache ⚠️ Only in case of problems Dalvik/ART virtual machine cache High. Clearing will cause all applications to be recompiled the next time you start.
/data/app-asec ❌ No Encrypted application data (for example, for an SD card) Critical. Deleting will lead to the loss of application data.

The folder /data/data deserves special attention - the data of all installed applications is stored here. You cannot delete its contents manually, but you can clear the cache of specific apps through the Android settings or using ADB. For example, the command:

adb shell pm clear com.example.app

It will completely reset the application data com.example.app (including settings and logins), but will not affect system files.

📊 How often do you clean out system folders on Android?
Never cleaned
Once every six months
Only when memory runs out
Regularly, once a month

Ways to clean system folders without root access

If your device does not have rights superuser (root), cleaning options are limited, but there are still several safe methods:

1. Built-in Android tools

Starting with Android 8.0 Oreo, the system has a function "Storage and cache"that allows you to delete unnecessary files without risk. To use it:

  1. Open Settings → Storage.
  2. Click on "Free up space" or "Clear cache".
  3. Select categories of files to delete (for example, "Downloads", "Application cache").

This method does not affects system folders directly, but removes junk that takes up space in the user partition.

2. Cleaning via ADB (without root)

Tool ADB (Android Debug Bridge) allows you to execute cleaning commands without obtaining root access. For example, to delete the cache of all applications, use:

adb shell pm trim-caches 1000000000

This command will free up the cache up to the specified limit (here - 1 GB). To clear a specific system folder (for example, /cache) it is suitable:

adb shell su -c 'rm -rf /cache/*'

But keep in mind: on most modern devices (for example, Pixel 7 or Samsung Galaxy S23) this command will not work without root.

💡

If the command adb shell returns an error permission denied, try first enabling USB debugging in Settings → For developers and confirm trust in the computer on the smartphone screen.

3. Using applications for cleaning

Applications like SD Maid, Files by Google or CCleaner can scan the system for garbage, but their capabilities are limited:

  • 🔍 SD Maid finds remnants of deleted applications and empty folders, but not can clean /system.
  • 📂 Files by Google suggests removing duplicate files and large unnecessary files (for example, old APKs).
  • ⚠️ CCleaner aggressively clears the cache, which can lead to slower applications.
⚠️ Attention: Some "optimizers" (for example, Clean Master or DU Speed Booster) can delete important files or show false warnings about “critical errors”. Use only proven utilities with high ratings in Google Play.

Cleaning system folders with root access: step-by-step guide

If your device has root, you get full control over system folders - but also full responsibility for the consequences. One wrong one rm -rf can make the phone inoperable.Therefore, before you start:

Make a backup via TWRP or Titanium Backup|

Check the battery charge (at least 50%)|

Install a file manager with root support (for example, Root Explorer or FX File Explorer)|

Disable the antivirus (it can block access to system files)|

Prepare an OTG cable or computer for emergency recovery-->

Now let's move on to cleaning. We will use Root Explorer (or a similar manager) and terminal ADB.

1. /cache

This is the safest folder for manual cleaning. It contains temporary files that the system will restore if necessary. Actions:

  1. Open Root Explorer and go to /cache.
  2. Select all files and folders (except lost+found, if any).
  3. Click “Delete” and confirm the action.

After cleaning, reboot the device. The first download may take longer - this is normal.

2. Removing log files from /data/log

Error logs that are rarely needed by the average user are stored here. To clear them:

adb shell

su

rm -rf /data/log/*

exit

exit

If you are using Magisk to manage root access, you can run the same command through the built-in terminal.

3. Clearing Dalvik-cache (only if necessary!)

The folder /data/dalvik-cache contains optimized files for fast loading of applications. Delete it only if:

  • 🐢 The system has become noticeably slower.
  • 🔄 You recently updated the firmware.
  • 📱 Installed many applications in a short period.

To clean:

adb shell

su

rm -rf /data/dalvik-cache/*

reboot

After a reboot, Android will automatically rebuild the cache, but the first launch of applications will be slower than usual.

💡

Cleaning dalvik-cache can help if applications constantly crash with the error ANR (Application Not Responding). However, you should not abuse this - frequent recompilation accelerates the wear of flash memory.

What to do if the phone does not turn on after cleaning

Even with careful actions, there is a risk of damaging system files. If after cleaning the device:

  • 🔄 Stuck on the logo (bootloop),
  • 📵 Does not respond to the power button,
  • ⚠️ Shows an error No Command or DM-Verity,

follow the following algorithm:

1. Try booting into Safe Mode

On some devices (for example, Samsung or Google Pixel) you can boot into safe mode by holding down the button "Power" and selecting the appropriate item. In this mode, all third-party applications are disabled, and the system can boot even with damaged data.

2. Recovery via TWRP

If you have custom recovery installed (TWRP),:

  1. Boot into TWRP (usually by holding Power + Volume Up).
  2. Select «Mount» and make sure that /data and /system.
  3. Go to «Advanced → File Manager» and check which files were deleted by mistake.
  4. If there is a backup, restore it via «Restore».

3. Flashing via Fastboot

If the phone does not boot even in TWRP, all you have to do is flash it via fastboot. To do this:

  1. Download the official firmware for your model (for example, from the website XDA Developers or Samsung Firmware).
  2. Boot into mode fastboot (usually Power + Volume Down).
  3. Connect the phone to the PC and run the commands:
fastboot flash boot boot.img

fastboot flash system system.img

fastboot flash recovery recovery.img

fastboot reboot

⚠️ Attention: This procedure will erase everything data on the device!

⚠️ Attention: On devices with a locked bootloader (for example, Huawei or some models Xiaomi), flashing via fastboot may lead to to block. In this case, you will need an official service center.

How to prevent clogging of system folders in the future

To avoid having to regularly clean out system folders, follow these recommendations:

  • 📵 Disable. automatic installation of updates for unnecessary applications This will reduce the number of temporary files in /cache.
  • 🗑️ Clear the cache regularly via Settings → Applications. It is enough to do this once every 1-2 months.
  • 🚫 Do not use memory “optimizers” like Clean Master —they often delete useful files.
  • 🔄 Update the firmware through official channels (OTA), and not through custom recovery, to avoid file conflicts.
  • 📱 Uninstall unused apps completely, rather than just “stopping” them.

If you frequently install and uninstall apps, consider using App Cloner or Island (for devices with rootThese apps create). isolated “sandboxes” where garbage does not clog the main system.

What is DM-Verity and why does it work after cleaning?

DM-Verity (Device-Mapper Verity) is a mechanism for checking the integrity of system files on Android If you deleted or changed a protected file (for example, in /system), on next boot DM-Verity will detect a hash sum mismatch and block the system from starting, showing an error "Your device has been corrupted". To fix this, you need to either restore the original files, or disable DM-Verity via Magisk (if it is installed).

FAQ: Frequently asked questions about clearing system folders

Is it possible to clear a folder /system without root?

No. The folder /system is write-protected at the Android kernel level. with ADB without root you will not be able to modify it. Any attempts to bypass this protection (for example, through exploits) will result in triggering SELinux or DM-Verity and blocking the device.

Why after? cleaning /cache has the phone started to slow down?

This is a temporary phenomenon. The folder /cache contains data for quickly loading the system and applications. After cleaning it, Android is forced to restore the cache from scratch, which requires additional resources. Usually, performance returns to normal after 1-2 reboots. data-i="267">How to clear a folder

How to empty a folder /data/app from the remnants of deleted applications?

It is best to use ADB with rights root:

adb shell

su

cd /data/app

ls | grep -v 'com.android' | xargs rm -rf

reboot

This command will delete all folders in /data/appexcept system ones (com.android.*). Be careful: erroneous deletion can disrupt the operation of services Google Play.

What to do if photos or contacts are missing after cleaning?

Most likely, you deleted files from /data/media/0 (internal memory) or /data/com.android.providers.contacts. Try recovering data using:

  • DiskDigger (for photographs),
  • Titanium Backup (if there is a backup),
  • service Google Contacts (if synchronization was enabled).

If files were recently deleted, do not write new data to the device - this will increase the chances of recovery.

Is it possible to clear system folders on Android 13 and later?

Starting from Android 10, Google has tightened control over sections /system and /vendor due to the mechanism Dynamic Partitions. Even with Android 13+ even with root modification of these folders can lead to:

  • blocking Google Pay and other services (SafetyNet),
  • refusal of warranty service,
  • automatic reset of rights root after updating.

We recommend limiting cleaning /cache, /data/log and application cache.