Problem: You are running a critical Windows Server on AWS EC2 and the C: drive is almost full (storage volume) but it should zero downtime (No Restart, No Stop then Start). Is this possible on AWS EC2?
Yes, it is possible.
Check the instructions below.
- Test Windows Server Settings
- Resize the EBS Volume attached to your Windows EC2 Instance
- Updating the File System on Windows to include the new size of the Volume
Test Windows Server
AMI | Microsoft Windows Server 2016 Base |
Instance Type | t2.micro |
Storage | 30 GiB – General Purpose SSD (gp2) |
Storage Size
We are increasing the Storage size from 30 GiB to the target size of 50 GiB.
You can set any size that you want as long as it is bigger than the current size.
Resizing Storage
To resize the volume of the Windows Drive on AWS you can follow the steps below.
1. Resize the EBS Volume attached to your Windows EC2 Instance
Go to the list of running EC2 Instances on your AWS Console.
Select the EC2 Instance where your Windows Server is running.
On the Description Tab, find Block devices. Since I only have one storage I only have /dev/sda1.
Note: You can have more than one Block devices if you have more than one storage device set for the instance. This can be done during creation of the instance or you can add the block device by modifying the instance.
Click on the volume (block device) that you want to resize. A grey box will appear like the screenshot below.
Click on the EBS ID. This will take you to Volumes page of the EC2 Console.
On the Volumes page of the EC2 Console make sure that your Device Block is selected.
Click on Actions >> Modify Volume.
Note: Size is in GiB.
Change the size to your new desired size then click Modify. In my case it is 50 GiB.
This will prompt a warning. If you are sure with your changes press Yes.
Refresh the page to check the updated Status of the volume. This will update to in-use – optimizing (0%).
Keep on refreshing until the Status becomes in-use – completed (100%).
We are now ready to use the resized Volume on our Windows Instance.
2. Updating the File System on Windows to include the new size of the Volume
Access your Windows Server via Remote Desktop (RDP).
Right click on the Window Icon located on the lower left then click Disk Management.
This will open the Disk Management Window.
As you can see from above screenshot, the increase in size of our Volume is not seen. To update this Click on Action >> Refresh.
Now we can see that we have a 20 GB of Unallocated Disk Space. For us to be able use the unallocated space, right click C: NTFS Blue Box then click Extend Volume…
This will open the Extend Volume Wizard Window. Click on Next.
Then the wizard will ask you how much of the available (unallocated) space would you like to Extend.
If you want to extend it fully, you do not have to edit any values since the Extend Volume Wizard will default to the maximum disk space it can extend.
If you are happy with the settings then click Next.
Review the settings then click Finish.
This will allocated the NTFS File System to cover my 20GB unallocated disk space, which would result to my newly resized 50GB C: Drive.
To check Open a Folder then click on This PC. This will show you the new size of the C: Drive.
Right click on the Local Disk (C:) then Properties to see the new size of the volume.
That is how you add storage capacity to your Windows Server Instance on AWS EC2.
There is another way to increase the size of a Local Disk on Windows EC2 by creating another Block Device and appending it to the previous Block Device in the Windows System. I am not a fan of that type of increase in Local Disk Size but for the purpose of discussion I shall write about it in the future.
For now, I hope this helps in your problem of increasing the Volume Size of your Windows Local Disk without Restarting the Operating System.
If you have any comments, questions, suggestions, additional information or anything related to the above topic kindly comment below.
Hi! May we shrink some disk without restart the server?
This is not possible. Once you have increased the size of the EBS volume it is no longer possible to shrink it.
If you need to temporarily increase the size I suggest that you create a new EBS volume then attach it to your instance. Put all the things that you need to process there, then detach the new EBS Volume and delete it.
This is very important content. Thanks for sharing