Linux 增加 AWS EC2 ubuntu 实例磁盘空间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9306829/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Increasing AWS EC2 ubuntu instance disk space
提问by Sangram Anand
i have a ubuntu instance(CRON server) of volume size 50gb. I want to increase its size to 100gb+
我有一个卷大小为 50gb 的 ubuntu 实例(CRON 服务器)。我想将其大小增加到 100GB+
Here are the steps i want to follow,
这是我想要遵循的步骤,
1) create a snapshot of the volume attached to CRON server.
1) 创建附加到 CRON 服务器的卷的快照。
2) create a volume with the newly created snapshot, by specifying the size you need. In my case 100gb.
2)通过指定您需要的大小,使用新创建的快照创建卷。在我的情况下是 100GB。
3) detach the existing volume for cron server by running the command
3) 通过运行命令分离 cron 服务器的现有卷
ec2-detach-volume old_volume_id cron_instance_id sda1
4) attach the new volume (i.e. 100gb ones) to cronserver
4) 将新卷(即 100GB 的)附加到 cronserver
ec2-attach-volume new_volume_id cron_instance_id sda1
please correct if am missing or not using a correct step.
如果遗漏或没有使用正确的步骤,请更正。
采纳答案by Roman Newaza
No, you're missing something - you end up with your old partition size.
不,你错过了一些东西——你最终得到了旧的分区大小。
Here's how you do it (pay attention to resize2fs
/ xfs_growfs
commands):
这是您的操作方法(注意resize2fs
/xfs_growfs
命令):
Resizing the Root Disk on a Running EBS Boot EC2 Instance.
调整正在运行的 EBS 引导 EC2 实例上的根磁盘的大小。
Example:
例子:
# In case your Filesystem is either ext2, ext3, or ext4
$ sudo resize2fs /dev/sda1
# Or if you have XFS
$ sudo apt-get install -y xfsprogs
$ sudo xfs_growfs /
回答by Stephen
In addition to the answer above, Amazon put out a guideas well. I used both resources when I was expanding my volume.
除了上面的答案,亚马逊还发布了一份指南。我在扩大交易量时使用了这两种资源。
回答by pir
As Chris Moore mentioned in a comment, the disk space is automatically increased on boot for any modern EC2 Ubuntu server, making this much easier. Here's the steps:
正如 Chris Moore 在评论中提到的那样,任何现代 EC2 Ubuntu 服务器在启动时都会自动增加磁盘空间,使这变得更加容易。以下是步骤:
- Open EC2 -> Elastic Block Store -> Volumes. Find the volume you want to increase by looking at the Attachment Information column.
- Select the volume and click Actions -> Modify Volume, then select the new volume size you want.
- Open EC2 -> Instances -> Instances, select your EC2 instance and click Actions -> Instance State -> Reboot.
- 打开 EC2 -> 弹性块存储 -> 卷。查看“附件信息”列,找到您要增加的音量。
- 选择卷并单击操作 -> 修改卷,然后选择所需的新卷大小。
- 打开 EC2 -> Instances -> Instances,选择您的 EC2 实例并单击 Actions -> Instance State -> Reboot。
You're done!
你完成了!