In this article, the loss of dc microgrid with distributed energy storage systems (DESSs) is modeled as one unified function of the output currents. Based on the theoretical proof of this article, the loss model is a smooth concave function and has only one extreme point. Then, a dual-ascent algorithm is proposed to online optimize the current distribution coefficients. The current distribution coefficients move in the direction of minimizing the distribution loss iteratively. The adaptive secondary control is applied to realize the given current sharing rate among DESSs. To cope with the changes in model parameters, one online line resistance identification method is designed in this article. Besides, a state-of-charge limitation mechanism is added to the control strategy to prevent deep discharge or overcharge. Thereby, the real-time loss minimization operation is achieved, regardless of line resistance and load variations. The simulation and experimental results are presented to verify the proposed hierarchical control in mitigating the distribution loss in various cases, including charging/discharging operation, output power clip, plug-in and out of DESSs, and daily operation.