Wednesday, April 20, 2011

Resizing Amazon EC2 Windows drives

The disk sizes that come with the Amazon Windows AMIs are a little small (35GB for a Windows 2008 R2). Since I am running demo servers I have not really been paying too much attention to laying out the disks properly. However, the 35GB disk is simply not enough so I had to resize it. This turned out to be surprisingly easy:
  1. Stop the instance
  2. Create a snapshot of the volume
  3. Create a new volume from that snapshot, specifying the new size
  4. Detach old volume from the instance
  5. Attach new volume to the instance
  6. Restart the instance
  7. Run diskpart and enter the following commands
    • select disk <disk number>
    • select volume <volume number>
    • extend
  8. Delete the old volume (unless you want to keep it as a backup)
Simple!

6 comments:

  1. Great, thanks. (I think you need to swap steps 2 and 1.)

    ReplyDelete
  2. The order seems right. You want to stop the instance to be sure that Windows is not doing anything before you start the snapshot.

    ReplyDelete
  3. Excellent blog Wing! the only thing that caused me issue was the device textbox generating 4 random letters which prohibited my instance from running. entering /dev/sda1 in that field resolved my issue.

    ReplyDelete
  4. Yeah, the Amazon instances seem to default to xvdf, etc for those disk devices, but we use /dev/sda1, etc for our Windows devices.

    ReplyDelete
  5. Just what I needed, thanks! The procedure reset the internal instance IP somehow, so had to reassign it to Elastic ip and security groups.

    ReplyDelete
    Replies
    1. That is correct. When you stop and start Amazon instances the internal IP and public IP both change. I have almost all my instances assigned to Elastic IPs

      Delete