New added security to most new Samsung devices often detect and prevents users from making changes (mods/customization) on the operating system. So when the security software sees your changes as risk, the device soft bricks and you will not be able to use it. Now when you turn the phone on, it hangs on logo and also when you put it in recovery mode, you see the error message dm-verity verification failed.
The following guide below will help you solve this problem on you Samsung device.
Make sure your device has at least 30% battery life
Do this at your own risk!!!
Extract the files found inside the stock firmware.
To do that, rename the extension of the file from .md5 to .tar only (ie delete md5 from name of file).
Then use either 7zip or winrar to extract.
Delete cache.img file from the extracted files.
Now copy all the extracted file into parts folder inside TAR_MD5_PACKAGER.
Press 1 then type the name of the new file you want to create and press Enter key.
When repackaged file is created, launch TAR.MD5_PACKAGER.bat again.
Now press 3 followed by 1. This will convert the file from .tar to .tar.md5
Press Y to start the process.
After few seconds, file is created.
You can follow the screenshots below on how to create repackage_rom for samsung devices.
You can now use odin to flash the newly packaged firmware created.
Hold Home + Volume down + Power button when message with triangle appear press volume up.
Connect device to PC with USB.
Click on AP and select the newly packaged ROM file.
Click Start button to begin flashing process.
When process is complete, you will see a Green PASS message and phone will reboot to normal.
Congrats you just successfully dm-verity verification failed on your Samsung device.