About ESP32 Flash:

Can I check the flash usage of ESP32 by command?

May be Project Inspect in PlatformIO Home is what you are looking for