The performance of a variety of geostructures, such as compacted clay liners, earth dams, and pavement embankments, is compromised by soil cracking. Experiments are set up to monitor the drying process of a clay layer under controlled temperature and humidity conditions. The gravimetric water content and images are captured automatically. Volumetric shrinkage of the bentonite sample as well as the crack patterns are determined from images. The monitored volumetric strain development is used to implement the discrete element method (DEM) to simulate the drying shrinkage and desiccation cracking. Model parameters are calibrated through unconfined compression tests on clay specimens at different water contents. This simplified calibration procedure allows characterization of the soil behaviors in the mesoscale and bypass the complex physicochemical processes involved. The initiation and propagation of cracks from the DEM model agree well with the phenomena observed in the laboratory experiments. The influence of boundary constraint and sample thickness on the crack patterns is analyzed, which includes the use of hydrophobic coating to diminish the boundary constraint. Major features of desiccation cracking can be replicated with the computational procedures. Boundary constraint, including surface roughness and strength of boundary layer, is found to significantly influence the final crack patterns.