## How much does data weigh?

An interesting question came up on StackOverflow: does a hard drive weigh more when it’s full than when it’s empty? Or more generally, does the weight of a hard drive change depending on how much (and what) data is stored in it?

First of all, as far as anyone in the IT industry is concerned, the answer is no. Any change in mass that would result from magnetic alignment is far too small to be measured by even the most sensitive scales in the world — we’re talking about a difference of something like $$10^{-14}$$ grams.

Now, how did I get that number?

Let’s start from the beginning. Every atom has a property called the magnetic dipole moment, which means it acts like a tiny bar magnet, with a north pole and a south pole. In a ferromagnetic material, the type that’s used to store data in a magnetic hard drive, adjacent atoms tend to align parallel to each other, so that their north poles all point in the same direction. This leads to the formation of magnetic domains, small groups of atoms which are all aligned; each domain acts like one tiny bar magnet. To use a simplified model, a magnetic domain whose north pole points toward the reading head represents a set bit (1), and a group of atoms whose spins point away from the head represents an unset bit (0). Recent drives use GMR (giant magnetoresistance) instead, which basically changes the electrical resistance of a chunk of the hard drive depending on whether the spins in two layers are aligned or antialigned — but still, the data is based on the alignment of magnets.

Magnets have differing amounts of energy depending on whether they’re aligned or antialigned. According to the laws of physics, the energy of a pair of magnetic dipoles is

$$E = -\frac{\mu_0}{4\pi}\frac{\mu_1 \mu_2 \cos\theta}{r^3}$$

that is, the product of the two magnetic dipole moments, times the cosine of the angle between them (which is +1 for parallel alignment or -1 for antiparallel alignment), divided by the cube of the distance between them.

Most people know that according to Einstein’s theory of relativity, energy corresponds to mass according to the equation $$E = m c^2$$

Well… technically it’s more complicated than that, but this equation is good enough for us. The important point is that just like mass, energy responds (“couples”) to gravity — that is, it has a weight. So we can take the energy difference between the two possible alignments of the magnets and divide it by $$c^2$$ to get the equivalent mass.

Back to those numbers I mentioned earlier. Suppose a hard drive contains 10 grams of data-storing cobalt, and the dipole moment of each atom is contributed by a single free electron, which means it’s equal to a constant called the Bohr magneton. (I make no claim that these assumptions are accurate, but they should be close to the right order of magnitude) There would be around $$10^{23}$$ electrons, but in a 1TB drive these group themselves into about $$10^{12}$$ domains spread over a total platter area of let’s say $$\SI{400}{cm^2}$$, which puts the average separation distance at around a tenth of a micrometer. Then assuming each domain interacts mainly with its 4 immediate neighbors, the total energy is around $$\SI{-5}{J}$$ if every domain is aligned in the same direction (that’s like a drive containing all zeros) or $$\SI{5}{J}$$ if the domains are antialigned. Dividing the difference by $$c^2$$ we get an effective “mass” difference around $$10^{-14}$$ grams. Given that a full hard drive weighs on the order of a kilogram, we’re talking about one part in $$10^{17}$$ (that’s 1 in 100 000 000 000 000 000)! This is typical of situations where energy is treated as a mass: because of the factor of $$c^2$$, a moderate amount of energy corresponds to an incredibly tiny mass.