Now if we dig down into the details both look seemingly impossible. For hard drives we have read heads that must sweep so close to the spinning platter that they use the wing ground effect to float just over the surface. We no longer can read data with the write coil (not enough gain) so instead we use spin polarization sensors that pass currents of electrons with only one intrinsic spin and then measure the effect the magnetic field of the platter had on the spin of the electrons in the current.
In the case of solid state memory, we are able to pattern silicon wafers with a minimum feature size of 22nm and falling. A single chip is a seemingly miraculous network of chemically deposited thin films and optically patterned cutouts all at a size that beats the detraction limit of light. The mask (imagine an overhead projector's transparency) can not be shaped the same as the intended end-shape pattern of silicon due to very small scale refraction but never fear! We have figured out how to calculate what our mask must look like to beat the diffraction limit. Its all amazing stuff.