How do I power off a droplet from a command line (to create a snapshot).

August 4, 2013 128.5k views
The text seems to suggest to power off a droplet from the command line to create a snapshot. But it does show how to do it.
1 comment
16 Answers
In Ubuntu:
sudo shutdown -h now
sudo shutdown -h now as Pablo said, or sudo poweroff.

ehm.. silly question but how do we "power on" a droplet? I don't see no power on button.

  • The power on button only shows up if the droplet has been powered down:

You still have to power it off from the Web UI before taking a snapshot. I was not able to take one after shutting it down. I had to explicitly power it off in the web UI
  • Nearly 2 years later, this still happens.
    I had powered off in ssh, but on the snapshot page there was no button to start the snapshot process. Without that button, the text there seems to mean that by powering off (as I had done) a snapshot was already, automatically, being created. That didn't really make sense, so I searched and found this question page.

    Request to DO:
    on the Snapshot page, please add this information :
    After powering off from within the droplet (sudo shutdown -h now or systemctl poweroff), we have to go to the Power page and power it off there too. (That doesn't do anything to the droplet in this situation, but it gets the web interface in sync.) Then go back to the Snapshot page and the "Take Snapshot" button will be there.

    • Can confirm that after powering off with sudo poweroff from the command line the server successfully powered off and the web UI was in sync, ie. It now has a "Power On" option. Looks like the good people at digitalocean fixed the problem now.

      • I did just that a while ago and can see no "Power On" button.

        • These things are working in today's time. shutdown syncs with status on the dashboard and power on button is available.

I used sudo poweroff in terminal, got locked out of SSH, and still had to power off from the web UI. After I powered off from the web UI and took a snapshot, my droplet powered on as soon as the snapshot finished (without me clicking "power on") and my SSH access was reestablished.

I have some vnc connection problem not allowing me to access my console. Can I power off using the web interface button [POWER OFF] instead?
Yes, but the consensus is that it should be used as a last resort. Are you able to access your droplet via SSH?
Is there a sync between the machine status and the online app?
i switched off from command line but on the console i keep seeing that it's Active.
However, ssh fails.

PS: how do i turn it on?
@stefano.tranquillini: It rarely gets out of sync but if that does happen please open up a support ticket.
Sites all down after clicking Power Off >> Take a Snapshot >>Power Cycle.

I don't think the problem is completely fixed. I had to request console access from the Web UI for it to recognize that I powered off from terminal.

The "poweroff" command worked perfectly for me when I used it after logging in as ROOT (so no need for sudo). When I went back to web interface, the droplet had indeed been powered down.

I did sudo poweroff but the control panel never showed it being powered off until I clicked the power off button in the control panel

Have another answer? Share your knowledge.