
Select Disk Utility from the macOS Utilities menu. Restart your Mac, and press Command + R, while it's restarting. If trying to repair the internal partition where your Operating System is installed, you'll need to boot into Recovery mode, so your Mac can check and repair files that are "in use". If using an external disk, then choose 'Repair Disk', and allow the process to complete. It should give you some diagnosis to confirm whether your drive is viable, or needs to be repaired. Once you've loaded Disk Utility, select 'Verify Disk' and allow your Mac to check the disk. You can locate Disk Utility within your Applications -> Utilities folder, or by searching "Disk Utility" in Spotlight.
This requires the computer to be booted in Recovery mode, and as repairing the internal partition can have serious repercussions, we advise performing a back-up of any crucial data before proceeding. It can also be used on your internal partition if you are having trouble with OS X. The most obvious example would be when there is drive corruption caused by improperly removing external USB storage. Repairing Disks using OS X's Disk Utility can be a useful way to improve performance, and in some scenarios, recover lost data.
As much a we all try to protect our computers, sometimes issues do arise with the drives where you store your data.