The thermodynamic limits of magnetic recording