SHORT ANSWER
You don't need to delete anything in /config
. What appear inside the directory aren't actual files. They are cleared and repopulated on device restart.
You can't delete /config/sdcardfs
directory. SDCard FileSystem (sdcardfs
) is a core OS component. Your device (or at least storage) won't be usable without sdcardfs
properly configured.
DETAILS
Android is based on Linux kernel. Kernel is the backbone of OS which handles hardware components and many other core functionalities. The other part of OS: userspace talks to kernel space through different mechanisms like syscalls
, sockets
and virtual filesystems. procfs
, sysfs
and configfs
are common virtual/pseudo filesystems i.e. they live in RAM. Kernel exports information about processes, hardware devices, and drivers etc. to user space through virtual files in these filesystems.
/proc
and /sys
are mostly read-only, except a few interfaces to which userspace can write some values in order to make configurations. configfs
(which is mounted at /config
on Android devices) is relatively a new addition to Linux kernel. It allows userspace to make relatively bigger kernel configurations by creating large number of virtual files in sub-directories under /config
.
Android uses configfs
at least for two purposes:
In order to make file sharing among apps possible, Android sets fixed permissions on files in external storage (be it physically internal or external). To achieve this, at start, Android used FUSE for filesystem emulation, then sdcardfs
replaced it. For more details see my answer to What is /storage/emulated/0/? and Android's Storage Journey, in particular the concept of synthesized permissions.
So it's the Android OS which creates and deletes virtual files in /config/sdcardfs/
in order to let kernel know which permissions to enforce on which files/directories in external storage (/sdcard
as well as physically external SD cards, USB drives etc).
Additionally Android uses sdcardfs
to assign three GIDs: AID_MEDIA_AUDIO (1055)
, AID_MEDIA_VIDEO (1056)
and AID_MEDIA_IMAGE (1057)
to media files by providing their relevant list of file extensions in /config/sdcardfs/extensions/
. It's to quickly categorize files without scanning all of them. See some details in this answer.
So deleting something in /config/sdcardfs
(and in kernel's other virtual filesystems as well) doesn't make sense if you don't know what you are doing. That would do no good except breaking storage functionality on your device.