NOTE: THIS ONLY NEEDS RAN ON INSTANCES ORIGINALLY LAUNCHED FROM AMIs EARLIER THAN v3.3 AND IT ONLY NEEDS RAN ONCE! If you are running an instance launched from AMI v3.3 or newer (including v4.x), you may simply resize your Root volume via the EC2 Console and reboot your instance to have the partitions resized for you automatically.
We have finally found a safe and sane method for resolving one of the biggest pain points a large AWS FreePBX deployment faces: The limitations of the 50GiB Root Instance Volume! You read that correctly; you can now enlarge the root instance volume beyond the 50GiB launch default. There are a couple of caveats:
You should stop your instance so that you can resize the root volume of the instance via the EC2 Console. The entire process only takes a few minutes, but you must plan for the downtime accordingly. If you are using an HA Cluster, you can simply perform a controlled FailOver to the Backup node, perform the changes on Primary, switch back to Normal mode, and then perform the changes on Backup. This reduces your downtime to mere seconds while the Cluster's Elastic IP swaps around
NOTE: AWS now lets you resize volumes without stopping the instance the volume is attached to. However, our automatic partition resize scripts are set to only run at boot, which means you should still stop/start or reboot your instance after any volume size change to allow the partitions to be properly resized. This also allows linux to properly rebuild the various caches and other metadata it needs for best performance based on the size of your volumes
This procedure will eliminate the dedicated swap partition on the root volume and replace it with a swap file located on the root (/) partition. While this, in theory, provides slightly slower access to swap space, swap is almost never used by a properly functioning and adequately sized AWS FreePBX instance, making this point moot in practice
As with all EC2 Volume resizing operations, you can always INCREASE a volume size, but you can NEVER decrease the size of a volume. You can perform this enlarging procedure as many times as you need as your demands require in the future, so you should only make incremental increases of the root volume. Most data is stored on the spool volume. The default starting size of 50GiB is fine for most small deployments. If you see that available space drops below about 5GiB on root (/) when you run 'df -h' via SSH CLI, you can increase the root volume to maybe 75GiB or 100GiB max, as this should be more storage space than you need on root long into the future...and you can always increase it again later!
YOU ONLY NEED TO PERFORM THIS PROCEDURE ONCE! After your swap has been moved to a file, you are free to simply stop the instance, resize the root volume, and start the instance again to have the partitions automatically resized on boot.
Here's a quick summary of the steps we will be performing:
Stop the Instance
If HA, FailOver Cluster and perform these steps with Primary first
Modify & Enlarge the Root (/dev/sda1) volume of the Instance via EC2 Console
Start the Instance via EC2 Console (or reboot if you resized while online)
Connect via SSH and run either of the following commands, depending on your version
For AMI v3.x:
smartupgrade enlarge-root
For AMI v2.x:
smartupgrade enlarge-root-2
That's it! You're all done.
If HA, Return Cluster to Normal and then repeat steps with Backup node
Here's details instructions for those who need more guidance:
First, you should stop your instance. If you have a single instance deployment, you can do this from the EC2 Console. If you have an HA Cluster, you should run ' cluster-mgr set-FailOver ' to switch services to the Backup node to complete this on Primary, then ' cluster-mgr set-Normal ' when it's time to complete this on Backup.
After you have stopped your instance, you will want to identify the root volume on the EC2 Console. We'll show you an easy way to do this:
After selecting the Instance, look in the Description tab for "Root device" and click on /dev/sda1 to get a popup showing the "EBS ID." Click this vol-####### and it will take you to the Volumes section filtering by this ID.


With the Volume now selected, click the Actions menu and then Modify Volume. You can then enter a Size greater than the current size. Click the Modify button when finished. You may now Start the Instance again.



Once the Instance is fully booted up, you must connect via SSH. You'll then run the following command to start the enlarge-root wizard.
For AMI v3.x:
smartupgrade enlarge-root
For AMI v2.x:
smartupgrade enlarge-root-2

Press ENTER to proceed. The rest of the process is automated.


You should see output similar to the panes above. Note the new size of the root (/) partition and the existence of the /swapfile
That's it! Your root volume is now enlarged. Everything should be operating normally. This concludes the enlarge-root guide. If you encounter any issues or have any questions, use the blue button to the right to contact us.