Growing Amazon EBS Volume sizes [closed]

2019-01-08 02:36发布

I'm quite impressed with Amazon's EC2 and EBS services. I wanted to know if it is possible to grow an EBS Volume.

For example: If I have a 50 GB volume and I start to run out of space, can I bump it up to 100 GB when required?

11条回答
Rolldiameter
2楼-- · 2019-01-08 03:37

All great recommendations, and I thought I'd add this article I found, which relates to expanding a Windows Amazon EC2 EBS instance using the Amazon Web UI tools to perform the necessary changes. If you're not comfortable using CLI, this will make your upgrade much easier.

http://www.tekgoblin.com/2012/08/27/aws-guides-how-to-resize-a-ec2-windows-ebs-volume/

Thanks to TekGoblin for posting this article.

查看更多
我想做一个坏孩纸
3楼-- · 2019-01-08 03:37

You can now do this through the AWS Management Console. The process is the same as in the other answers but you no longer need to go to the command line.

查看更多
老娘就宠你
4楼-- · 2019-01-08 03:37

Use command "diskpart" for Windows OS, have a look here : Use http://support.microsoft.com/kb/300415 Following are the steps I followed for a non-root disk (basic not dynamic disk)

Once you have taken a snapshot, dismounted the old EBS volume (say 600GB) and created a larger EBS volume (say 1TB) and mounted this new EBS volume - you would have to let Windows know of the resizing (from 600GB to 1TB) so at command prompt (run as administrator)

diskpart.exe

select disk=9

select volume=Z

extend

[my disk 9,volume labelled Z, was a volume of size 1TB created from an ec2-snapshot of size 600GB - I wanted to resize 600GB to 1TB and so could follow the above steps to do this.]

查看更多
姐就是有狂的资本
5楼-- · 2019-01-08 03:38

My steps:

  1. stop the instance
  2. find the ebs volume attached to the instance and create a snapshot of it
  3. create a new volume with bigger disk space using the above snapshot. Unfortunately the UI on the aws console to create a snapshot is almost unusable because it's listing all the snapshots on aws. Using command line tool is a lot easier, like this:

    ec2-create-volume -s 100 --snapshot snap-a31fage -z us-east-1c
    
  4. detach the existing ebs (smaller) volume from the instance

  5. attach the new (bigger) volume to the instance, and make sure attach it to the same device the instance is expecting (in my case it is /dev/sda1)
  6. start the instance

You are done!

Other than step 3 above, you can do everything using the aws management console.

Also NOTE as mentioned here:

https://serverfault.com/questions/365605/how-do-i-access-the-attached-volume-in-amazon-ec2

the device on your ec2 instance might be /dev/xv* while aws web console tells you it's /dev/s*.

查看更多
我欲成王,谁敢阻挡
6楼-- · 2019-01-08 03:38

I highly recommend Logical Volume Manager (LVM) for all EBS volumes, if your operating system supports it. Linux distributions generally do. It's great for several reasons.

  1. Resizing and moving of logical volumes can be done live, so instead of the whole offline snapshot thing, which requires downtime, you could just add create another larger EBS volume, add it to the LVM pool as a physical volume (PV), move the logical volume (LV) to it, remove the old physical volume from the pool, and delete the old EBS volume. Then, you simply resize the logical volume, and resize the filesystem on it. This requires no downtime at all!

  2. It abstracts your storage from your 'physical' devices. Moving partitions across devices without needing downtime or changes to mountpoints/fstab is very handy.

It would be nice if Amazon would make it possible to resize EBS volumes on-the-fly, but with LVM it's not that necessary.

查看更多
登录 后发表回答