| 1 | = How to reboot a physical server and guests = |
| 2 | |
| 3 | On occasion we need to reboot a physical server and all of it's guests (often due to a kernel upgrade). This is an intensive process and can take a long time as many servers need to run fsck on reboot which demands intensive disk activity. This page documents the currently recommended process for such reboots. |
| 4 | |
| 5 | == Make sure all guests on a host are updated == |
| 6 | * run package updates |
| 7 | {{{ |
| 8 | apt-get update |
| 9 | apt-get -s dist-upgrade |
| 10 | }}} |
| 11 | * if the server needs upgrades |
| 12 | {{{ |
| 13 | apt-get dist-upgrade |
| 14 | }}} |
| 15 | |
| 16 | == Check available disk space == |
| 17 | * Make sure there is available space on the logical volumes, and take appropriate steps if not, see [[extend-disk-on-kvm-guest]] |
| 18 | * if you added disk space from the host, reboot the guest with |
| 19 | {{{ |
| 20 | shutdown -h now |
| 21 | }}} |
| 22 | |
| 23 | == Determine if the guest will fsck on reboot == |
| 24 | * On kvm guests or vserver hosts check when the next fsck is scheduled for all logical volumes with: |
| 25 | {{{ |
| 26 | for i in $(ls /dev/mapper/vg_* | grep -v swap); do tune2fs -l $i | grep Next; done |
| 27 | }}} |
| 28 | * '''e.g.''' |
| 29 | {{{ |
| 30 | 0 malcolm:~# for i in $(ls /dev/mapper/vg_* | grep -v swap); do tune2fs -l $i | grep Next; done |
| 31 | Next check after: Fri Oct 11 12:12:47 2013 |
| 32 | Next check after: Fri Oct 11 12:12:28 2013 |
| 33 | Next check after: Thu Aug 29 23:16:36 2013 |
| 34 | Next check after: Fri Oct 11 13:07:33 2013 |
| 35 | Next check after: Fri Oct 11 13:08:17 2013 |
| 36 | Next check after: Fri Oct 11 13:08:40 2013 |
| 37 | 0 malcolm:~# |
| 38 | }}} |
| 39 | * If a guest will fsck on reboot (i.e. the date from the above is earlier than the current date). Reboot a kvm guest from root@GUEST with. You can watch reboot progress with `ssh -t guest@host screen -x` |
| 40 | {{{ |
| 41 | shutdown -r now |
| 42 | }}} |
| 43 | |
| 44 | '''Do this for all guests on the host.''' |
| 45 | |
| 46 | == Take down the host's guest == |
| 47 | '''FIXME: Add better information for vservers''' |
| 48 | * From 'root@host' check running services: |
| 49 | {{{ |
| 50 | cd /etc/service |
| 51 | for x in *; do sv status $x; done |
| 52 | }}} |
| 53 | * Take down each guest's service: |
| 54 | {{{ |
| 55 | sv down GUESTNAME |
| 56 | }}} |
| 57 | * Make sure the guest has gone down, this may take a few seconds. |
| 58 | * If the guest has not gone down in a short time, you may need to manually restart from `root@guest` with: |
| 59 | {{{ |
| 60 | shutdown -h now |
| 61 | }}} |
| 62 | * Check to make sure all guests are down, repeat the status command above. You should see a line that starts with `down: GUESTNAME` for all guests. |
| 63 | |
| 64 | == Reboot the host == |
| 65 | * Assuming all the guests are down, you should be able to restart the server. |
| 66 | * Get access to the serial console |
| 67 | * Telehouse use [[telehouse_serial_access]] |
| 68 | * XO use [[xo_serial_access]] |
| 69 | * Shut down the system from `root@host` with |
| 70 | {{{ |
| 71 | shutdown -r now |
| 72 | }}} |
| 73 | * Watch the reboot process from the serial console and enter the encrypted password when requested (accessed via keyringer) |