Was running dd really the first thing that came to your mind?
If you buy used hardware you should always check its condition visually before installing it. You don't want to damage your system by carelessly installing hardware with short circuits. After that you can install the hardware and check if it is detected properly by looking into system logfiles.
S.M.A.R.T.can be used to check the condition and wear of consumer HDDs and SSDs. You can run the Disks program from a live session which will display all SMART data for each drive in a submenu. The general recommendation is, if any of these values is not okay, then you shouldn't use the drive any longer and try to backup what you can. ddrescue is recommended over dd, but it should be noted that such programs put very much stress onto a device, so using dd to "format" a drive in an unknown condition may not be a good idea in the first place.
A similar question has been posted on the Unix & Linux site of the StackExchange network (which AskUbuntu is part of): Hard disk drive disappeared