Skip to content

Rebooting a system

To prevent unplanned downtime, it's crucial to take specific precautions before initiating a reboot. The method followed to reboot a system can significantly impact whether the process is successful.


Practice

Considerations before rebooting a system.

0. Check if a reboot is required

Install the dnf-utils package, which provides the needs-restarting command. After updating the system packages, run the needs-restarting -r command to see if a restart is required.

1. Active Users

Minimise disruption for logged in users by notifying them about the reboot. - Use the who or w commands to see a list of logged-in users. - Send a message to all logged in users, warning them of the impending reboot.

wall "This system will be rebooted by the Ops team at 13:00 today"

2. Open Files

Confirm that all important files have been saved and that no processes are writing data to the disk. - Force all data in the buffer to be written to the disk.

sync

3. Mounted filesystems

Mount failures at boot time can prevent the system from fully booting up. Check that all mounts can be mounted successfully before rebooting the system.

  • List all currently mounted filesystems.
    mount
    
  • Verify that all mounts in /etc/fstab can be mounted successfully.
    mount -a
    

4. Scheduled jobs

Rebooting in the middle of a backup or maintenance job can result in an incomplete state. Check the scheduling of jobs and schedule the reboot accordingly.

  • List currently scheduled jobs.
    crontab -l
    

5. Checking Filesystems

Rebooting with a full /var filesystem has historically caused problems with servers coming back up. Check your filesystem space and act accordingly.

  • Check filesystem usage
    df -h /var
    
  • Depending on your environment, there could be additional filesytems that could hinder reboot. To check the rest of the filesytems.
    df -h
    
  • If the list from the standard df -h is unmanagable to look through due to extra tmpfs, overlay, shm, snap filesystems. They can be excluded with the below
    df -h -x <filesystem type> [-x <filesystem type> ...]