Resize the root/boot volume of an AWS host

From techdocs
Jump to navigation Jump to search

This procedure involves the host nw-syd-vxdb. It involves an extra few steps to safeguard the /localstorage volume)…

Running order

  1. Do a test on a created-for-the-occasion VM running the same OS
  2. Always check that commanded operations complete via AWS console when doing shutdown, resize, snapshot, detach, attach, etc.
  3. Create /etc/nologin. Test that root can still log in, and that users can't login via SSH or XDM/VNC
  4. Check that there's a root password set in case we need to login on the console later
  5. Shutdown VM (and wait until stopped. See AWS console) and create AWS image (or volume snapshot, or both) as backup. This step takes in the order of ten minutes or more. Watch status on console to determine when it's done
  6. Boot
  7. Unmount and comment out /localstorage entry in /etc/fstab
  8. Shutdown (or reboot, check /localstorage is not mounted, then shutdown)
  9. Detach localstorage volume so it's safe
  10. Boot (to make sure we can), then shut down again
  11. Resize root volume using AWS console (can take some time/many minutes). Monitor the status on AWS console.

    See also AWS document: Extend a Linux file system after resizing a volume.

    It appears that Debian Bullseye automagically detects the resized disk and does the required operations on boot. Either that or AWS is very clever itself during the resize.

  12. Boot
  13. All OK? Check new root volume size (df -m)
  14. Shutdown
  15. Re-attach localstorage volume
  16. Boot
  17. Restore /localstorage entry in /etc/fstab. Check with mount -a
  18. Reboot and make sure all volumes are mounted and are the right size (df -m)
  19. Delete /etc/nologin and check that users can log in (Hmmm. /etc/nologin had mysteriously disappeared on its own)
  20. Delete backup image and/or snapshot created earlier
  21. Reward yourself with some chocolate