Resize the root/boot volume of an AWS host
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
- Do a test on a created-for-the-occasion VM running the same OS
- Always check that commanded operations complete via AWS console when doing shutdown, resize, snapshot, detach, attach, etc.
- Create
/etc/nologin
. Test that root can still log in, and that users can't login via SSH or XDM/VNC - Check that there's a root password set in case we need to login on the console later
- 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
- Boot
- Unmount and comment out
/localstorage
entry in/etc/fstab
- Shutdown (or reboot, check
/localstorage
is not mounted, then shutdown) - Detach localstorage volume so it's safe
- Boot (to make sure we can), then shut down again
- 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.
- Boot
- All OK? Check new root volume size (
df -m
) - Shutdown
- Re-attach localstorage volume
- Boot
- Restore
/localstorage
entry in/etc/fstab
. Check withmount -a
- Reboot and make sure all volumes are mounted and are the right size (
df -m
) - Delete
/etc/nologin
and check that users can log in (Hmmm./etc/nologin
had mysteriously disappeared on its own) - Delete backup image and/or snapshot created earlier
- Reward yourself with some chocolate