Before diving into complex partitioning, rule out the simple hardware glitches:
Verify your model number (e.g., SM-G973F) matches the firmware exactly.
Use Odin v3.14.4 or newer for recent Samsung models.
Fixing the "Repartition Operation Failed" Error in Odin: A Complete Guide