How to Increase the Root Disk Device Size of an EBS backed Windows Instance

How to Increase the Root Disk Device Size of an EBS backed Windows Instance

The default size of a root disk on an a new EC2 instance can be easily changed. Unfortunately AWS doesn’t help you set it up by their AWS console and you will need to have some AWS and as well as some system administration knowledge in order to preform that. In this guide we will describe how to extending an already-in-use windows instance’s root disk (C drive) by de-attaching its EBS volume, extending it and attaching it back to its original instance.

Enter you AWS account console and follow the below steps:

1.  Launch a new Windows Instance.

2.  Launch EBS backed Windows instance. In our example we selected to generate  the new instance in AWS US West (Oregon) region from the AMI: ami-d8179be8.

4.  Ensure that you have opened the remote desktop (RDP) port 3389 for connecting to windows. Due to potential security risks we recommend to open the RDP port for your specific IP only (Below you can see that all ports are open to all IP, note that this is obviously not the best practice). For more information we invite you to learn how to add a rule to a security group

5.  Verify all your launch details. We are using our AWS account secret keys. Learn how to create a new key pair for an EC2 Instance.

6.  Once you confirm the details, it will launch the instance and will show in the console as below. Note down the public DNS of instance.

7.  Generate the password for your Windows instance as mentioned in Connecting to AWS Windows instance from Windows Machine.

8.  Store the password at some safe place. We will require this when we want to connect to instance using RDP.

9.  Enter EC2 > EBS volume section. It will list all available, In-use volumes of your account in this region.

10.  Note down the Mount path of attached volume. (/dev/sda1) and volume number.

11.  Create the snapshot from the windows selected volumes.

12.  Provide the required details to create a snapshot.

13.  Once snapshot is created it will be available in EC2 snapshot area.

14.  Create a new EBS volume of larger size from the snapshot.

15.  We will create new volume of 50 GB instead of current 30 GB size. Please select the same availability zone as your instance. Note that if you create volume in other availability zone (AZ), you will not be able to attach it with the  instance.

16.  Once you select “Yes,Create”, it will create new volume of 50 GB size.

17.  Go to volumes section and view the  list all existing volumes including new created 50 GB volume.

18.  Now we need to detach the original 30 GB volume first.

19.  Select the EC2 Instance and stop it. Since this is EBS backed instance, we can stop it.

20.  Enter the EC2 volumes section and select the windows volume (30 GB) to be detached.

21.  Detach the EBS Volume from instance.

22.  Once the volume is detached, it will change status to “available” from “in-use”.

23.  Attach the new created 50 GB volume to instance at same mount path. (/dev/sda1).

24.  Provide the same device mount path as original volume.

25.  Once volume is attached it will be shown as “in-use” status instead of available status.

26.  Restart the windows instance which was stopped in step#19.

27.  Connect to windows instance using RDP (mstsc).

28.  Once you have logged into the machine, go to Start > Administrative Tools > Computer Management as shown below.

29.  It will show the computer management screen.

30.  Select ‘Disk Management’ on left hand side as shown.

31.  It will show the current disk drive size as 30 GB only and shows 20 GB as unallocated. The original volume was of 30 GB and we increased it by creating new 50 GB volume. SO 20 GB increased size is still unallocated.

32.  Now right click on “C” volume and select the ‘Extend Volume’ option.

33.  It will show the extend volume wizard. Press ‘Next’ and complete the wizard option with default values.

34.  Once completed all the steps, the disk management will show that your current drive is of 50 GB size.

35.  You can also validate it simply by going to “My Computer” and verify ‘C’ drive size.

36.  This way we have increased the root volume size of EBS backed Windows instance from 30 GB to 50 GB.

37.  If you do not want to use the snapshot or old volume you can remove it to save some cost. Learn more on how to Create or Delete an EBS Volume Snapshot. In order to make sure that you are not leaving any resources behind that will cost you on your monthly bill you can use Newvem to analyze your AWS usage patterns to help you be more cost efficient on AWS.

 

There is 1 comment .

prateekbhargava —

Lovely post :) Saved my skin

You must be to post a comment.

* As a bonus, you'll receive our weekly newsletter!

Hitchhiker's Guide to The Cloud

Newvem's eBook for Cloud Operations