1984 Trek 620, Fisher Y-bike, Bike Friday NWT, Rans Rocket, Cinderella Cycles Model 1, Dahon Mariner & Boardwalk, Bike Friday tikit, 1977(?) Raliegh DL-1, Disc Trucker
I'd be afraid a hard-drive magnet would be too strong and would pull apart any glue or lightweight connection you might use. The magnets on my Dahon are pretty modest, and they're screwed into a waterbottle bolt sized hole in the fork. The fittings are spring loaded for a little bit of flexibility. Perhaps you could insert the magnets into a pair of bracelets made from tubular nylon webbing sized to fit the frame tubes you want to attach to. The webbing would be thick enough to keep the magnets from sticking too hard, and be flexible enough to give an ajustable fit. You might have to stitch them onto the frame so the fit wouldn't be too loose, but that would be a pretty easy sewing job.
I attached Dahon magnets (magnetix) to an unbranded folder with the plastic mounting bracket from an LED. It was fiddly to put together but worked fine once in place. In the UK you can buy the magnets from dahonspares.co.uk.
Most magnets found in hard drives are not only really strong, they are VERY brittle. Two of them smashing together repeatedly can result in nastiness.
Most rare-earth magnets that are used for this kind of application are put in some kind of protective housing to prevent things from busting up, but the magnets in hard drives tend not to.
I hear you. I did some googling and it looks like epoxy, such as j-b weld might work to attach to the frame. J-B Weld has been used to fix cracked engine manifolds! However, that would be permanent...
Another option is putting it in some sort of webbing, like Disposable said. I will probably try that first since it's reversible.
I could also glue a chunk of delrin or other soft plastic to the impact side of the magnet which will cushion the hit and act as a spacer so it's easier to pull apart. In fact, I have some plastic resin mold making stuff I could use to embed the magnet.