TWRP: Could not mount /data (even after format data / change file system) I'm trying to root a Vernee M5. I installed TWRP - which worked - and tried to use it to install Magisk - which didn't work (my guess is because of encryption?). 

Now the phone always boots into recovery/TWRP and I want to install the factory ROM so I can try rooting it again.

However, using TWRP to install the ROM fails with the error:

[...]
Updating partition details...
Failed to mount '/data' (Invalid argument)
...done


Rebooting the device opens TWRP again.

I tried Wipe -> Format Data -> yes, which also fails:

[...]
Updating partition details...
Failed to mount '/data' (Invalid argument)
...done
Unable to mount storage


I also tried Wipe -> Advanced Wipe -> Data -> Repair or Change File System. Changing the file system fails with the above error message. Repair also results in an error:

/sbin/e2fsck -fp /dev/block/mmcblk0p48 process ended with ERROR: 8


Some additional info: TWRP is not asking for a password anymore when booting. Internal Storage is shown as 0mb on "install", but it does still contain a folder structure. The console also shows that full SELinux support is present &amp; MTP is enabled. 

How can I fix these errors and install the factory ROM?
While formatting with twrp results in an error, formatting with fastboot worked for me:


start phone, which will boot into twrp
reboot -> bootloader
fastboot format:ext4 userdata. This will of course delete all data from the phone.