The head is the component that senses the magnetic field stored on the hard disk platter. It uses the giant magnetoresistance (GMR) effect to detect the very weak magnetic fields. In very simple terms, the material changes its resistance depending upon the alignment of a magnetic field.
The material is typically composed of conductive layers sandwiched in an alternating fashion. It changes resistance significantly when there is a magnetic field present. When the field is in parallel alignment with the layers its resistance drops, and increases in anti-parallel.
This graphic shows the four layers that typically make up a GMR head. These layers slide over a track on a disk platter. The track is made of vertically oriented poles, commonly created by a technique called Perpendicular / Vertical Recording.
The blue layer contains electrons that are free to spin in either direction. In the free layer, the electrons are free to rotate. This layer is also the sensing layer, because it is responsible for sensing the rapidly changing perpendicular magnetic poles along a track on a disk.
When the pole underneath the sensing layer is north - south oriented, the electrons spin in one direction. If the pole is in south - north orientation then the electrons spin in the opposite direction. The direction in which the electrons spin causes the resistance between the layers to change.
There are two advantages to using the GMR effect for sensing magnetic fields. The first advantage is the sensitivity it has to weak magnetic fields. A very weak magnetic field can cause a gigantic change in the resistance of the layers. The change in resistance fed to a preamplifier circuit could generate a useful signal.
For a rapidly changing magnetic field on a spinning platter, a sensor that can keep up with the change is very useful. With GMR, this is possible because electrons can change their direction very fast.
The conventional method to sense a magnetic field was to use a coil, when passed over a magnetic field would induce a current. This method was not sensitive enough for the weak magnetic fields. It also placed a limit on how fast the platter could spin.
Spin Valve Principle
The spin valve is a play on two words; spin as in the spin of an electron, and 'spin valve' as in a water tap. In America, a tap is a 'spin valve'...
The amount of free electrons that a metal has determines its resistance. A metal that allows a small number of free electrons to pass through it has a high resistance, and vice-versa. The GMR effect is able to change the amount of free electrons able to pass through the metal and therefore they behave as a tap or a spin valve.
The purple layer in the diagram above is the pinned layer because the electrons in that layer are not free to spin or move, and the electrons are all 'pinned' in a clockwise direction.
The electrons in the free layer (blue) are able to move and spin clockwise or anti-clockwise. The direction of the spin depends upon the magnetic field of the perpendicular poles.
When the electrons in the blue layer spin clockwise, they align with the electrons in the purple layer, which are also pinned in the clockwise direction. Hence the overall resistance between the layers drops.
When the electrons in the blue layer spin anti-clockwise, they fall out of alignment with the electrons in the purple layer, which are pinned clockwise; hence, the overall resistance between the layers increases. It is quite simple actually, it is amazing that it took so long to discover.