Log inSign up

Restart or power off your server without losing data

From an SSH session run sudo systemctl reboot to restart now, or sudo shutdown -r +10 "Kernel update" to restart in ten minutes with a warning (cancel with sudo shutdown -c). Use the console Restart or Stop action only when the server no longer responds, because it does not give services the same clean stop. After any restart, check uptime and systemctl --failed.

Topic: Server basics · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13, Rocky Linux 9, AlmaLinux 9 · Updated 2026-12-03

When does a server need a reboot?

Reboot after a kernel update, after core library updates you cannot restart around, and when you want to prove that everything comes back on its own. Most other updates take effect after restarting the affected service, which tools like needrestart do for you (see automatic security updates). Check whether a restart is pending:

# Ubuntu and Debian
cat /var/run/reboot-required 2>/dev/null
# Rocky Linux and AlmaLinux
sudo dnf needs-restarting -r
# any system: running vs installed kernel
uname -r

A clean reboot also catches mistakes early. A service that was started by hand but never enabled, or a mount missing from /etc/fstab, is much easier to fix during a planned restart than after an unexpected one.

How do I reboot or power off from inside the OS?

Use systemctl; it stops every service in order, syncs the disk and then restarts or powers off:

sudo systemctl reboot
sudo systemctl poweroff

The classic commands sudo reboot and sudo poweroff call the same systemd actions on all current distributions. Your SSH session closes at once; wait about a minute, then reconnect. A powered-off server stays off: start it again with the Start action on the instance page in the console. Avoid reboot -f and systemctl reboot --force unless a normal reboot hangs, because they skip the orderly service stop.

How do I schedule a reboot with a warning?

shutdown accepts a delay in minutes or a clock time and broadcasts a message to logged-in users:

sudo shutdown -r +15 "Restart for kernel update"
sudo shutdown -r 03:30 "Nightly maintenance"
sudo shutdown -c
date

The time follows the server clock, so check it with date first. While a shutdown is pending, new non-root logins are refused during the final five minutes. shutdown -c cancels it. For a one-off reboot at a precise moment that survives your logout, a transient timer works well:

sudo systemd-run --on-calendar="2026-12-06 04:00" systemctl reboot
systemctl list-timers --all | grep run-

How do I set up a regular reboot schedule?

Create a systemd timer, or a root crontab line, that runs the reboot at a quiet hour. With a timer the schedule shows up in systemctl list-timers like every other job:

sudo tee /etc/systemd/system/weekly-reboot.timer >/dev/null <<EOF
[Unit]
Description=Weekly reboot

[Timer]
OnCalendar=Sun *-*-* 04:20:00
Unit=reboot.target

[Install]
WantedBy=timers.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now weekly-reboot.timer

The crontab version is a single line, added with sudo crontab -e:

20 4 * * 0 /usr/bin/systemctl reboot

The cron and timers guide explains both formats. Many admins prefer reboots only when needed, as set up by the reboot policy in unattended-upgrades.

When should I use the console power actions instead?

Use the console when SSH no longer works or the system is frozen. The instance page offers Start, Stop and Restart (described in power actions). They act on the virtual machine from the outside, like pressing a power button:

  • Restart resets the VM. Use it for a hung kernel, a server stuck in swap, or a firewall rule you applied only in memory and never saved, which a restart clears.
  • Stop turns the VM off. Use it when you want the server off and cannot reach it.
  • Start boots a stopped server again.

An outside reset gives programs no chance to finish writes, so databases may need to replay their logs on the next start. Prefer the in-OS commands whenever you still have a shell. There is no browser console, so if a server boots but SSH fails, open a support ticket rather than repeating restarts.

What should I check before a planned reboot?

Spend a minute confirming that everything important will start on its own and nothing is mid-write:

systemctl list-unit-files --state=enabled --type=service
systemctl is-enabled nginx postgresql
who
sudo findmnt --verify

Make sure long-running work lives in services, not in a terminal; a job in a tmux session stops at reboot. Pause queue workers or stop a database cleanly if it holds a lot of unflushed data. If you changed firewall rules or SSH settings, test a second login before rebooting, so a mistake does not take effect at the same time as a restart.

How do I confirm the server came back correctly?

Reconnect and check uptime, failed units and the logs from the boot:

uptime -s
systemctl --failed
journalctl -b -p err --no-pager
uname -r
ss -tlnp

To look at the shutdown of the previous boot, which is useful after an unexpected restart, read the journal of boot -1:

journalctl --list-boots | tail -3
journalctl -b -1 -n 50 --no-pager
last -x reboot shutdown | head

If the previous boot ends without a clean shutdown sequence, the VM was reset from outside or crashed. Kernel messages such as out-of-memory kills or file system errors in that boot show the cause.

What if the server does not come back?

Give it two or three minutes, since file system checks after an unclean stop can take time. Then test from your computer:

ping -c 3 198.51.100.24
nc -vz 198.51.100.24 22

If ping answers but SSH does not, the system booted and something in the SSH or firewall setup is wrong; a firewall rule that was active only in memory before the reboot is a common cause. If nothing answers, try one Restart from the console, then open a ticket through support tickets with the time of the reboot. As a last resort a reinstall gives a clean system, but it erases the disk.

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
A1-1reboots in seconds on any size1 vCPU, 1 GB RAM, 25 GB NVMe$3.60/mo$43.20 for 12 months

Questions about Reboot and shut down safely

Is sudo reboot the same as systemctl reboot?

On current Ubuntu, Debian, Rocky and Alma, yes. Both ask systemd for an orderly reboot.

How long does a reboot take?

Usually well under a minute for the OS itself. Services with large datasets, such as databases or blockchain nodes, may need extra time before they accept connections.

Does a reboot change my IP address?

No. Your IPv4 and IPv6 addresses stay with the server across reboots and power actions.

Why was my server restarted at night?

Check whether automatic updates have Automatic-Reboot enabled, look for timers with systemctl list-timers, and read journalctl -b -1 for the end of the previous boot.

Can I reboot without dropping my session?

No, every SSH session ends. Run long jobs as systemd services so they come back automatically after the restart.