DEV Community

Samuel Ajisafe
Samuel Ajisafe

Posted on

Expand your root EBS Volume attached to your Windows EC2

Are you running low on Space (Storage) attached to your AWS Windows Server and looking for a solution that can scale the volume with zero downtime?

This article with give you a direct approach of expanding your Windows EC2 volume without having a downtime.

An EC2 Windows instance launched with an Amazon Machine Image (AMI) has a 30-GiB General Purpose SSD (gp2) root volume by default. You can expand the disk space of your EBS volume attached to your Windows EC2 instance by following these steps:

  1. Expand the EBS volume's size by through the Amazon EC2 console or the AWS Command Line Interface (AWS CLI).
  2. Extend the EBS volume's file system space at the operating system level with Disk Management or PowerShell. Expand the EBS volume's size Use the Amazon EC2 console or the AWS CLI to expand the size of your EBS volume.
 Use the EC2 console to expand the EBS volume
  3. Open the EC2 console.
  4. In the navigation pane, choose Instances, and then select your instance.
  5. Choose the Storage tab, and then select your volume.
  6. In the Volumes pane, select the check box for the volume you want to expand.
  7. From Actions, choose Modify volume.
  8. Under Volume details, enter the Size and IOPS based on the volume type.
  9. Choose Modify, and then choose Modify in the dialog box.
  10. In the Volumes pane, see the volume's optimizing progress under Volume state. Refresh the Volumes pane to see progress updates.
  11. When the Volume state shows that the volume is optimizing, you can extend the EBS volume's file system.

Extend the file system after resizing an EBS volume using Powershell.

To extend a file system using PowerShell

  1. Before extending a file system that contains valuable data, it is a best practice to create a snapshot of the volume that contains it in case you need to roll back your changes. For more information, see Create Amazon EBS snapshots.
  2. Log in to your Windows instance using Remote Desktop.
  3. Run PowerShell as an administrator.
  4. Run the Get-Partition command. PowerShell returns the corresponding partition number for each partition, the drive letter, offset, size, and type. Note the drive letter of the partition to extend.
  5. Run the following command to rescan the disk. "rescan" | diskpart Run the following command, using the drive letter you noted in step 4 in place of . PowerShell returns the minimum and maximum size of the partition allowed, in bytes. Get-PartitionSupportedSize -DriveLetter To extend the partition to the maximum available size, run the following command. Resize-Partition -DriveLetter -Size $(Get-PartitionSupportedSize -DriveLetter ).SizeMax

The following PowerShell commands show the complete command and response flow for extending a file system to the maximum available size.

Image description

Top comments (0)