How do I resize a volume?

Follow

Due to current limitations with Amazon Linux/CentOS distributions not automatically resizing their filesystem to match the actual partition size, resizing a volume is currently a task that should only be attempted by those comfortable using SSH and running CLI commands on their server.

The resize itself will take around 15 minutes, but you should allow a 30 minute outage window in case of the unexpected. The server should be accessible after booting and during the resize2fs operation, though potentially under some moderate I/O load.

CloudMGR takes a snapshot of the volume immediately before the resize of the volume begins, which you can restore from if anything goes wrong.

  • Within the CloudMGR interface, on the Volumes tab for your server, make a note of the device name (i.e. /dev/xvda, for the root device/root volume) for the volume you want to resize, as you'll need this later

  • Verify that you can SSH into the server, and that you have the root password, or sufficient sudo access to run resize2fs or similar (online) filesystem resizing tools, depending on the filesystem you're using. (resize2fs works for ext2, ext3, and ext4, which is the most common filesystem types for Linux OSs. Google 'resize2fs' or enter man resize2fs while logged in to see usage documentation for resize2fs.)

  • While you're logged in, work out the partition name for the volume you want to resize. The lsblk command is useful for this, and if you're resizing the partition/filesystem mounted at '/' (aka the root filesystem), this will likely be xvda1, or /dev/xvda1, to give the full name expected by resize2fs

  • When you're within your declared outage window, navigate to the Volumes tab in CloudMGR and press the  button for the relevant volume, enter your desired size (in gigabytes), then click  to resize the volume.

  • Amazon Linux/CentOS-based Linux distributions don't automatically resize the filesystem within the volume's partition, so once the server is rebooted, you'll need to log in via SSH again, and use resize2fs (or similar) to resize that filesystem. You won't likely need to specify the size; resize2fs will expand the filesystem by default to the full size of the underlying partition. You'll likely just need to run resize2fs /dev/xvda1, but please double-check this against the details you've obtained in earlier steps, and the resize2fs documentation.

 

Have more questions? Submit a request

Comments

Powered by Zendesk