The Genius Bar has a more extensive set of tests they can run. Be aware that since your problem is intermittent, they would probably want to keep your iMac at least over night for thorough testing.
If this is happening after a
cold boot and your iMac has a fusion drive my suspicion would be the had drive portion of the fusion drive is getting a little slow to spin up which is par for the course with
rotating rust. If you have an appropriate version of Micromat's
TechTool Pro or
Drive Scope the
detailed S.M.A.R.T. attributes
MIGHT yield more information about the expected long term health of your drive.
If this is happening after your iMac has been
asleep (not powered down) in System Preferences > Energy Saver try setting;
- Prevent your Mac from automatically sleeping when the display sleeps to ON
- Put hard disk to sleep whenever possible to OFF