Ouch, filesystem changes do indeed wipe the data, that's a hard lesson.Ok I assume it's not neccesary in my case then. But I have another question: do I understand correctly, first I install new rom, then I install Magisk apk and create the magisk .img and flash it right?
Edit: I couldn't see my storage in TWRP to install MIUI 14 Stable (TWRP didn't asked for password) and tried some random fix from the internet to change the file system to Ext 2 and then to Ext 4 and in the process I lost all the data anyways (the author didn't warn about it), so my question is not up to date now.
You were probably using an incompatible TWRP version.
Yes that procedure is correct. You can also flash the magisk apk in recovery, it's the same process as flashing the image.
Do refer to the guide posted here though.