22 September 2014

Amazon provides a verbose explanation of how to expand the volume. However, as long as the volume is strictly for storage, and the storage can be taken offline for a few minutes, then the process is really pretty easy. The instructions below work on Ubuntu 14.04 when using ext2/ext3/ext4 file systems.

  1. Create a snapshot of the volume.
  2. Launch a new volume based on that snapshot.
    1. Select the correct region and volume type based on your EC2 instance and preferred data speed
    2. Increase the volume size
  3. CLI: Unmount the old volume: `umount /drive/path`
  4. Online: Detach the old volume
  5. Online: Attach the new volume
  6. CLI: Resize the new volume: `resize2fs /dev/xvdf` (change the "f" as appropriate)
  7. CLI: Mount the new volume: `mount -t ext4 /dev/xvdf /drive/path` (use your normal system mount command, including any flags)

You can reduce downtime by reorganizing these steps. In many cases, resizing will even work after the new volume is mounted (swap steps 6 and 7). If the data is being updated constantly, then you will either need to turn the site off during the transition or add steps to rsync any changes that might have been made between snapshot creation and mounting the new volume.

Technologies:


blog comments powered by Disqus