OxyR controls magnetosome formation by regulating magnetosome island (MAI) genes, iron metabolism, and redox state.