How do I solve these problems when flashing Samsung Galaxy J5 (SM-J510FN)? The Iusse

Well, this is normally a simple task but I have a lot of problems. I hope you can help me. To begin, let's explain the situation: I have an SM-J510FN device with firmware from Spain to which, according to what I have been told, the unlock pattern was changed and the owner does not remember it, so he can not unlock the phone.



What I've tried

1: The first thing I did was enter Recovery mode with Power + Volume Up + Home. After showing me the android icon looking for updates, I get a screen that says "Sin comandos" ("No commands") for a few seconds. Then the menu appears in which I choose "Wipe data / factory reset". When doing this, this message appears in red:

E:format_volume: make ext4 failed on /dev/block/bootdevice/by-name/userdate with 1(I/O error)




2: After this failure, I downloaded Odin3 (V3.12), Samsung drivers and a firmware from sammobile, the most updated with Android 7 for this device, which is not rooted (I say in case it has something to do with the problems )

I open Odin, I select the firmware where it says "AP", I connect the phone and start it with Power + Volume Down + Home, and the screen that says "Downloading, Do not turn off target" appears. In the log, odin says: 

&lt;ID:0/003&gt; Added!!


I configure the options in this way:



After a few minutes in which progress bars in Odin and on the phone are advancing, and messages appear in the log, Odin looks like this:



Obviously, the phone restarts, but it does not start the system normally. Return to the Recovery menu, the same one that I entered to try de factory reset. Select "Reboot system now" and this time if it enters the system... but the same system, with the same unlock pattern. Nothing has changed. 

I tried to go back to the Recovery menu in case at least the error had been fixed when I tried to do the factory reset, but it was still the same,

I have to say that I have tried the same with previous versions, even with Android 6 that is the one that comes from factory, but the problem is the same.



3: I tried exactly the same as before, only adding Odin a PIT file for this device and checking the option of "Re-Partition", but the result is the same: Odin does everything he has to do without giving any error, but when it's over, the phone restarts and everything stays the same.



I do not know what else I can try to restart this device. Any ideas?
The file system may be broken or something. Or the file system are read-only for some reasons...

You should know that flashing with Odin and "normal" (AP)  firmware doesn't wipe the phone, it just upgrade the system but leave the user data partition untouched.

Assuming there is no hardware failure (damaged eMMC), such errors can be corrected by flashing a "repair" firmware which contains a script that wipe everything in the phone.

Try searching for "4 files firmware" on the internet then flash with Odin. Should work now.