Difference between ADB shell and TWRP terminal
I wouldn't tamper with partitions currently in use – which would be the case when the system is booted up. While booted into recovery, they are not in use unless you explicitly mount them (or if they'e auto-mounted, you can unmount them and still have a system running).

So things like repartitioning or formatting are better done from recovery. Same applies to imaging (dd) where you want to be sure the contents don't change while you create that "disk image", as you want it to be consistent (not an issue with partitions mounted read-only of course).

And again this applies if you want to repair the file system: the corresponding partition must be unmounted for that, which cannot be done e.g. for the /data partition while booted up normally – fsck (File System ChecK) requires exclusive access to it.



As for your underlying problem: I'd recommend to boot into recovery and run a file system check first to see if any partition is corrupted. In most cases, fsck is also able to repair the corruption, and you'll keep your data that way. If fsck finds issues it cannot solve (or you want to be "absolutely sure and clean"), you still can run that make_ext4fs – which of course would mean "all data lost". If you do that on /system it also means you need to flash a ROM afterwards, as your OS would be gone. And if you do it to any partition other than /system, /data or /cache (or the SD card), you might brick your device as you wouldn't know what to put there to bring it to live again. Oh, and also make sure the partition you want to "format" is really using ext4 before running make_ext4fs against it. While it should be transparent, an unexpected file system might confuse the OS :)