JOINT BASE BALAD, Iraq  There is no more visible sign that America is putting the Iraq war behind it than the colossal operation to get its stuff out: 20,000 soldiers, nearly a sixth of the force here, assigned to a logistical effort aimed at dismantling some 300 bases and shipping out 1.5 million pieces of equipment, from tanks to coffee makers.

It is the largest movement of soldiers and matériel in more than four decades, the military said.

By itself, such a withdrawal would be daunting, but it is further complicated by attacks from an insurgency that remains active; the sensitivities of the Iraqi government about a visible American presence; disagreements with the Iraqis about what will be left for them; and consideration for what equipment is urgently needed in Afghanistan.

All the while, the Army must sustain its current force of about 124,000 troops across the country, trucking in fuel, food and other essential supplies while determining what to leave behind for the 50,000 troops who will remain in a mostly advisory role until 2011.

“It’s a real Rubik’s Cube,” Brig. Gen. Paul L. Wentz, the commander of the Army’s logistical soldiers, said in an interview at this sprawling military complex north of Baghdad, which will serve as the command center for the withdrawal effort.