If you’re trying on a Mac using Disk Utility to erase a hard drive and it won’t unmount, giving you an error similar to Disk erase failed. Couldn’t unmount disk, then you may have to force an unmount through the terminal.
Launch up Terminal.app (through /Applications/Utilities or through a Spotlight search).
Then paste in the command:
Find the one you want to force unmount. For this example, let’s say it’s /dev/disk2.
Run a command similar to this one
You should now be able to erase the drive.