The reaction mechanism of all-solid-state lithium–sulfur batteries was studied by small- and wide-angle X-ray scattering. The results revealed that sulfur deposited in the electrode framework has a random distribution on the carbon wall of the highly ordered mesoporous carbon, CMK-3. Heat treatment complicated carbon surfaces with attached sulfur and improved the reversible charge–discharge reaction. Two Li2S phases formed during the discharge reaction; one of them participates in the reversible battery reactions.