amazon-web-services - 在不丢失任何数据的情况下增加 EC2 磁盘存储
问题描述
我有一个正在运行的t2.medium
实例,它具有4GB
体积RAM
和体积。25GB
EBS
该实例当前正在运行一个Apache
服务器、一个 wordpress 应用程序、一个 mysql 服务器和一个 codeigniter 应用程序。
我不希望任何数据丢失。
如何将音量增加到 100GB?
我在这里找到了一篇文章,但我不确定这样做是否会导致所有数据丢失。
解决方案
我们可以在不分离卷或重新启动实例的情况下增加 ebs 卷。如果发生不好的事情,最好创建 ebs 卷的快照
用于创建快照
Go to your EBS volume list from your EC2 Dashboard.
Right click the volume.
Click Create Snapshot link.
Add the description value any thing is good here.
Add key : Name and value : snapshot-your-volume.
Click button Create Snapshot.
增加尺寸
Right click on the volume you wish to increase.
Add your desired size; In our example type 40.
Click Modify.
You will get confirmation to extend OS file system.
Click Yes.
修改完卷后,您需要扩展 OS 文件系统才能看到增加的卷大小。
ssh into your instance
df -h -> will tell you the volume size
lsblk -> display information about the block devices attached to your instance
sudo growpart /dev/xvda 1
df -h -> to verify the size again
sudo resize2fs /dev/xvda1
扩展文件系统的文档
推荐阅读
- ibm-doors - 如何在 IBM Rational DOORS 中导入电子表格
- visual-studio-code - 如何在 VSCode 中禁用斜体?
- javascript - 将数组与对象数组匹配并获取值
- nmea - AIS 句子顺序消息 ID 用法
- python - 沿列对二维数组进行排序的 Pythonic 高效方法
- kotlin - Kotlin 中学班建设者
- java - 为什么spring-data-redis ZSetOperations范围操作返回Set而不是SortedSet?
- c++ - Number 和 Shape 超类中的 vtable 错误
- kubernetes - 在本地 Kubernetes 集群上安装 OpenFaas
- loadrunner - 负载运行器中的巨大响应时间