WASHINGTON — The Centers for Disease Control and Prevention advised schools on Friday that closings for at least eight weeks might be the most effective way to contain the coronavirus. The Education Department released school districts from a slew of testing and accountability measures required by federal law.

But schools across the country were far ahead of the Trump administration’s advice. A cascade of public school closings gained speed nationwide on Friday, with the largest school district in California, the Los Angeles Unified School District, announcing it was closing, along with the San Diego Unified School District. They joined other large cities like Washington, Miami and Seattle, and more than a dozen states like Virginia, Ohio, Maryland, Pennsylvania, Oregon, New Mexico and Michigan.

At least 21,000 schools have been closed or are scheduled to close, according to Education Week, affecting at least 15 million students. A majority of closings announced by school districts range from two to six weeks, which the C.D.C. considered “short- to medium-term closures” that would “not impact” the huge wave of infections that are expected in the next few weeks.

Danny Carlson, the associate executive director of policy and advocacy for the National Association of Elementary School Principals, called the timing of the C.D.C. guidance “baffling.”

“Where was this a week ago?” he said.

The C.D.C. conceded that long-term closings could significantly affect academic outcomes for students, economic conditions for struggling families and health conditions for grandparents who care for students.

And while it had data that could help decide when to close schools, the C.D.C. said it did not have data on the right time to reopen them.

On Thursday, the Education Department announced that it would relieve school systems of some of their responsibilities under federal law. It will consider one-year waivers for state-administered tests or requirements that districts test 95 percent of their students. It would also allow waivers for certain measures of a school’s effectiveness ratings, such as chronic absenteeism, as required under the Every Student Succeeds Act.

The department also said schools were not obligated to provide special education while classes were canceled for all students, but they must resume services when they reopen or if they shift classes online.

The administration’s guidance came at the end of an anxiety-ridden week for elementary and secondary school leaders who have argued over whether to follow their counterparts in higher education in sending students home.

The C.D.C.’s previous guidance had advised only on hygienic measures and local decision-making. It was quietly updated on Thursday to include a recommendation that a school should consider closing for two to five days if it had a confirmed case.

While colleges and universities moved swiftly to empty campuses and teach remotely for the next several weeks — some for the entire semester — school superintendents have had to contend with the fact that mass school closings could upend entire cities. The nation’s public school system serves more than 50 million students — more than double the number of college students — and provide the most reliable form of child care and social services.

“In college, you’re dealing with adults and the ability to provide online instruction, which many colleges are already doing. That’s not the case in K-12,” said Daniel A. Domenech, the executive director of AASA, the School Superintendents Association. “In terms of educational continuity, we’re going to see a lot of disparity between the districts that have the capacity to do it and those that don’t.”

Congressional lawmakers and education leaders have pressed Education Secretary Betsy DeVos to help schools navigate the mass closings. The most vulnerable students in public schools rely on critical services like food and special education.

Those hardships have led some of the nation’s largest school districts, like New York City — which serves overwhelming numbers of homeless and poor students — to hold off on shutting down.

“There are three pillars to protecting this city and the long-term health and safety of our people: our Schools, our mass transit and our health care system,” Mayor Bill de Blasio of New York said on Friday.

Randi Weingarten, the president of the American Federation of Teachers, said the Trump administration had left schools “agonizing” over decisions that stemmed from a lack of preparation — including enough testing — early in the crisis.

“Because there’s no way to track the vector, people don’t want to put anyone in harm’s way,” she said.

Facing pressure from parents, conflicting messages from experts and silence from the federal government, superintendents moved on their own.

By 12:15 p.m. on Thursday, Superintendent Michael Lubelfeld of the North Shore School District in Illinois was hurrying from his fourth meeting of the day, having just sent his fifth letter of the week about the coronavirus. He had informed the community of his decision to postpone activities, events and gatherings, without the blessing of the public health department.

“In the past 48 hours, it has become profoundly clear to me that the speed at which this situation is developing exceeds that of communication coming from government agencies,” Mr. Lubelfeld said.

After 12- to 18-hour days of monitoring news reports and communication with more than a half dozen government agencies and coordinating with 45 superintendents in his county, Mr. Lubelfeld was still grappling with whether he should close his 4,000-student district.

“We prepare for all types of occurrences, from the God-forbid active shooter to the typical water main break, to the ice day and snow day,” he said. “I cannot think of something that has been at such a scale.”

By Thursday Mr. Lubelfeld had already started preparations, reaching out to the local food pantry, library and township to ensure that the 25 percent of students who received federally subsidized meals would have food. The district had purchased three-month subscriptions for internet hot spots for 50 families.

Still, when he walked in to the emergency school board meeting he had called that evening, Mr. Lubelfeld was unsure — until he faced impassioned parents and frustrated board members.

“Now is not the time for complacency; it is the time for decisive action,” pleaded Mia Levy, a mother of two students who is also a doctor and the director of the Rush University Cancer Center. “Your actions will save lives.”

Daniel Wertheimer, a father who had already pulled his children out of school, told Mr. Lubelfeld that “because you’re keeping the schools open, there’s going to be folks — elderly, our age — that probably die, and that decision is on you.”

Bennett W. Lasko, the president of the school board, expressed frustration that the district was left to make the decision alone, citing “imperfect information, inconsistent from one authority to another.”

“We’re volunteers up here, and we’re a reasonably smart group of people, but we’re not able to assess the pros and cons of closing schools,” he said.

During the meeting, Mr. Lubelfeld looked at his iPad and learned that at least two neighboring districts and two states had decided to close schools. The Illinois governor had held a news conference at 5 p.m., canceling large group gatherings, including school assemblies.

By the end of the meeting, Mr. Lubelfeld announced that he planned to keep schools open and update the community on a long-term plan for closings by Friday morning.

Less than two hours later, Mr. Lubelfeld sent his sixth letter of the week: “To safeguard the health and wellness of students, staff and the community, I have made the decision to close all schools in North Shore School District 112 effective immediately.”

This story was originally published by The New York Times, and can be found here.