Macbook Air intermittently can't find startup disk
Hard disk drive failure

A few weeks ago I found similar symptoms with a colleague's iMac: 


sometimes it behaved as if no drive was installed
sometimes during normal use, the Mac stopped working (not a total freeze; the reported symptoms were as if there was an I/O issue) – this was less likely to occur if the Mac was cool
in FireWire target disk mode, every time I tried to fully optimise its disk, the Mac behaved as if the drive had disappeared. 


A replacement hard disk solved the problems for the user. 

Testing your own hard disk drive

If you have an external optical drive, you could perform a thorough backup then try the most powerful test of HDAT2. 

Caution

A routine that is intended to reallocate bad blocks may lead to dataloss. 



In response to commentary

A clean installation might complete without error – and you might precede that with a single write of zeros throughout a volume – but still (I could/should have mentioned this in my first edition): I'd be wary. 

If an entire drive has failed to present itself to software, at any time in the past, then to me that sounds a quiet but unforgettable alarm … expect the unexpected, and so on. 

I should either:

a. no longer trust that hardware; or 

b. perform extraordinarily time-consuming stress tests, which might reveal the nature of the failure and/or partially rebuild trust in the hardware. 

In a geeky way I'm sometimes happy to spend/waste that time, but option (b) is not for everyone. 

Related, in Ask Different

For bad and/or marginal blocks on hard disks, can anything be more effective than a single pass of zeros?

– all three answers were good. The accepted answer there links to a Tom Nelson article that includes: 


use of Drive Genius (page 3) – in my experience not extending the scan significantly reduces the likelihood of detection of bad blocks
a Disk Utility approach to stress testing (page 4) – and for that stress test to be most effective, you should aim to repeatedly write over as much as possible of the disk before your clean installation of the OS. 


(I wonder … can a Disk Utility approach be thorough enough to repeatedly write over the areas of disk that would be used for the GPT, and so on?)



Personally: if presented with a disk that might benefit from a multi-pass stress test, I would prefer HDAT2 to Disk Utility. Set aside the machine for a few days, allow HDAT2 to write repeatedly to the entire device …