A Guide to Resizing EBS Volumes on AWS EC2 Instances

AWS EC2 Instance with Resized EBS Volume

To change the size of an existing EBS volume on an EC2 instance without deleting it, you can follow these steps:

  1. Create a Snapshot of the Existing Volume:

    Before you can resize the volume, it’s a best practice to create a snapshot of your existing EBS volume as a backup. You can do this through the AWS Management Console by going to the “Elastic Block Store” section and selecting your volume. Then, click “Actions” and choose “Create Snapshot.”

  2. Modify the Volume Size:

    You can increase the size of the EBS volume using the AWS Management Console, AWS CLI, or AWS SDKs. Here are the steps to do it through the AWS Management Console:

    a. In the AWS Management Console, go to the “Elastic Block Store” section.
    b. Select your EBS volume that you want to resize.
    c. Click the “Actions” button and choose “Modify Volume.”
    d. In the “Modify Volume” dialog, increase the “Size” field to your desired size.
    e. Click “Modify” to apply the changes.

  3. Connect to Your EC2 Instance:

    To make use of the increased volume size, connect to your EC2 instance via SSH or your preferred method.

  4. Resize the File System:

    Depending on your operating system and file system type, you may need to resize the file system to utilize the newly allocated space. For example, on a Linux system with an ext4 file system, you can use the resize2fs command:

    sudo resize2fs /dev/xvdf
  5. Verify the Disk Size:

    To verify that the disk size has been increased, you can use commands like df or lsblk to check the available space.

By following these steps, you can successfully change the size of an old EBS volume attached to your EC2 instance without deleting the volume. Make sure to back up your data and snapshots before making any changes to your volumes for data protection.

 

× Chat with me