Hi, you can use check disk utility to resolve Need to format drive error. Follow the steps given below.
As you inserted an image and it shows that your hard drive is G.
1. Go to Run and type cmd.
2. Type the command chkdsk G: /r
3. If a pop appears for recover file simply proceed by selecting yes.
4. If the above command does not fix the issue, type chkdsk G: /f command.
I hope this command will fix need to format error.