Dislocation nucleation from free surfaces is one of the important process of plastic deformation of a size reduced pillar, in which pre-existing dislocations is not sufficient to take plastic deformation. In this work, nucleation of a basal dislocation from a free surface of an elliptic cylindrical Mg single crystal is considered. Molecular dynamics simulations of tensile deformation of crystals show that the nucleation site of a dislocation changes when the ratio between axes of the ellipse changes, though the critical resolved shear stress is almost the same. Dependence of the activation free energy of nucleation of a dislocation on the nucleation site is also studied by applying metadynamics method to the atomistic simulation. Then, we found that the activation free energy of nucleation of a dislocation lowers at the site where a dislocation is actually nucleated in molecular dynamics simulations.