The sawtooth mode of convection of Earth's magnetosphere is a 2- to 4-hour planetary-scale oscillation powered by the solar wind-magnetosphere-ionosphere (SW-M-I) interaction. Using global simulations of geospace, we have shown that ionospheric O(+) outflows can generate sawtooth oscillations. As the outflowing ions fill the inner magnetosphere, their pressure distends the nightside magnetic field. When the outflow fluence exceeds a threshold, magnetic field tension cannot confine the accumulating fluid; an O(+)-rich plasmoid is ejected, and the field dipolarizes. Below the threshold, the magnetosphere undergoes quasi-steady convection. Repetition and the sawtooth period are controlled by the strength of the SW-M-I interaction, which regulates the outflow fluence.