Could a hard drive actually have been erased as described in Cryptonomicon?

There's really two parts to your question, which I'm going to answer separately. First of all, the explicit question:

Could a huge electromagnetic coil erase a hard drive carried through it?

Sure it could. That's pretty much what a degausser does, and these things are routinely used to erase magnetic media, including hard drives.

OK, with that out of the way, let's move on to the implied question:

Could you actually do that, without the person carrying the drive noticing?

Based on some quick research, my conclusion is: no way in hell.

To quickly and reliably degauss a hard drive, you apparently need a magnetic field strength on the order of 15,000 Gauss (= 1.5 Tesla). Even if we assume that the Ordo hard drives were old and maybe specifically selected for low coercivity, we're still talking several thousand Gauss at least.

For comparison, the field strength inside a typical MRI scanner is also around 1.5 Tesla, while the field at the surface of a modern neodymium–iron–boron (Nd2Fe14B) rare earth magnet — basically, the strongest permanent magnet you can get — is around 1.25 Tesla.

Thus, someone walking through Stephenson's "degausser door" with a bunch of hard drives would experience something similar as if they tried carrying them through an MRI coil — or holding them while standing right next to a humongous door-sized Nd2Fe14B magnet slab.

Now, if you've ever played with neodymium magnets, you'll know that even tiny ones are damn hard to pry off any ferromagnetic objects they touch. To quote the Wikipedia page I linked to above:

"Neodymium magnets larger than a few cubic centimeters are strong enough to cause injuries to body parts pinched between two magnets, or a magnet and a metal surface, even causing broken bones."

As for MRI scanners, there's a reason why the first and last thing they check, when you go and have an MRI scan, is that you have nothing potentially ferromagnetic on or in your body. The reason is that anything ferromagnetic that gets too close to an active MRI magnet is likely the get torn off your hands and violently slammed against the magnet. This has been known to happen to pretty much any wholly or partially ferromagnetic object you'd care to imagine, from wheelchairs, office chairs and floor polishers to scissors, oxygen bottles (which killed a small child) and even pistols (which, yes, went off when it hit the scanner).

So, let's imagine what'll happen to your hapless policeman, as he's walking towards the magnetized door carrying a stack of hard drives. The first thing he's likely to notice, while still several meters away, is that something's pulling at the drives he's carrying (since they have a lot of ferromagnetic metal in the casing, and even some pretty strong magnets inside). If he's not careful, the drives might slip out of his hands and fly through the air towards the door, slamming against the door jamb with enormous force (and, yes, likely getting pretty well wiped in the process).

The next thing he might notice, if that's not enough to make him stay well away from the door, is that the same force is also tugging at his badge, gun, zipper, belt buckle, the screwdriver in his pocket that he used to open the servers and extract the hard drives, and anything else metallic that he might have on him. If he's not careful, and keeps approaching the door, those items might either get pulled out of his pockets, or they might simply get drawn to the door and pull him along with them. If he's lucky, the only thing getting pinched between the door and the objects is his clothing. If he's not...

Of course, that's all assuming that, when the magnet turned on, it didn't immediately turn any nearby chairs, tables, computer equipment and miscellaneous office supplies into flying missiles, with potentially lethal consequences to anyone standing between such an object and the door. Or that the intense magnetic field didn't simply mess up the unlucky officer's pacemaker, as it would surely do to any cell phones or other electronic equipment they might be carrying.


In Theory...but Not In Reality

It's one of those ideas that is possible in theory but impractical in practice.

Hard drives in computers are surrounded by a metal case of the drive, then the metal case of the computer. Even if you specifically got a non-metal case there is still some shielding there.

To generate a magnetic field strong enough to reliably have the effect of wiping all the data at the range you need to wipe it at you would also affect other things - such as for example the metal on clothing/equipment of the people going into and out of the room and the metal in the computer itself.

People would notice their police badge flying off long before they tried taking a computer through the door.

If you want to self destruct your data then applying something directly to the drive is a much easier way to do it, although with modern forensic techniques even that requires a certain amount of care and attention.

Note that causing some corruption to the drives is much easier than wiping them. Destroying a few sectors might cause your computer to stop working but a lot of the data on that drive will still be readable.


Possibly.

Degaussing is the process of destroying data on a hard drive using an electromagnetic field, so there's some scientific basis to the idea. Assuming the electromagnet was sufficiently strong and there was no or very little shielding around the hard drive - which, if you were building a large electromagnet around a doorway specifically for this purpose, you could make sure was the case - then it could in theory be used to destroy a standard hard disk drive.

There'd be no guarantee that all of the data would be destroyed, the drive would almost certainly be unusable afterwards, and you couldn't ever switch to solid state drives.