AWS now seems to allow the in-place resize of volumes attached to its modern instances (which Blot uses). I have been following the guide to resizing a volume on AWS
I also read the page on the limitations to modifying volumes and none seem to apply to my case. One thing to be aware of is the delay between subsequent modiﬁcations.
In general, use the following steps when modifying a volume:
Issue the modiﬁcation command. For more information, see Modifying an EBS Volume from the Console and Modifying an EBS Volume from the Command Line.
Monitor the progress of the modiﬁcation. For more information, see Monitoring the Progress of Volume Modiﬁcations.
If the size of the volume was modiﬁed, extend the volume’s ﬁle system to take advantage of the increased storage capacity. For more information, see Extending a Linux File System after Resizing the Volume .
These are the steps I followed speciﬁcally:
Before re-sizing the instance, create a snapshot of the running instance on the AWS dashboard. This might take a while, since Blot’s volumes are decently large. If something goes wrong, you can create a new volume from a snapshot and then attach it to Blot’s instance.
I then resized the volume attached to the Blot instance on the web console. I veriﬁed that the instance and volume types could be resized in place (as the server ran) safely. I waited for the modiﬁcation to complete then sshed into the instance.
I used ‘df -h’ and ‘lsblk’ to verify that while the volume had increased in size, the partition that was mounted was still at the previous capacity.
To resize the partition, I used these two commands:
sudo growpart /dev/xvda 1 sudo resize2fs /dev/xvda1
I wasn’t aware of these commands before performing the resize. According to the manual, growpart extend a partition in a partition table to ﬁll available space. I probably should have used ‘–dry-run’.
Go to Blot’s running instance and create a new amazon machine image (Actions > Image > Create image) This will be used to launch a new instance with the same disk?
Create new instance with larger disk. Set up nginx with letsencrypt verify it works with staging domain (blot.is?) Ensure it has keys and can transfer ﬁles from old instance with scp
Switch to maintenance state on old instance nano conﬁg/ﬂags.json sudo stop blot && sudo start blot
Backup db on Blot node scripts/backup.js
On the new instance sync blog folders: rsync -avL –progress -e “ssh -i /var/www/blot/conﬁg/secrets/projects.pem” firstname.lastname@example.org:/var/www/blot/blogs/* /var/www/blot/blogs
6.On the new instance, sudo copy acros redis dump: sudo stop redis scp -i /var/www/blot/conﬁg/secrets/projects.pem email@example.com:/var/www/blot/db/dump.rdb /var/www/blot/db/dump.rdb sudo start redis
Verify it is up to date
Switch elastic IP from old db to new DB
create snapshot of disk of old instance
associate this with new instance
get new instance up and running and veriﬁed
switch old instance to maintenance mode
bgSAVE old instance
copy old instance (now read only in maintenance) dump ﬁle to new instance disk
reload new instance DB with new dump ﬁle
switch elastic IP to new instance
blot should now be running in NEW MODE