Amazon 上的 EC2 实例,我收到“磁盘上没有剩余空间”的消息
我已安装 Amazon EC2 fedora 实例并将文件从一个位置复制到另一个位置。 但我收到的是“磁盘上没有剩余空间”。
我做了df -f
。
输出:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 15G 15G 0 100% /
none 312M 0 312M 0% /dev/shm
我想增加亚马逊上 ec2 实例的空间。有人可以帮我吗?
I have installed Amazon EC2 fedora instance and copying the files from one location to another.
But I am greeted with " No space left on the disk".
I did df -f
.
with output:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 15G 15G 0 100% /
none 312M 0 312M 0% /dev/shm
I want to increase the space for ec2 instance on amazon. Can someone help me with it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
这是一个更简单的方法。 (我的 m2.2xlarge 实例是使用 RedHat Linux 6.2 创建的,我发现它只有 850gb 中的 6gb 可用空间):
$df -h
/dev/sda1
)实例类型的空间,例如在我的 m2.2xlarge 情况下为 825GB)
停止
Here's an even easier method. (My m2.2xlarge instance was created with RedHat Linux 6.2, I discovered it had a paltry 6gb available of it's 850gb):
$df -h
/dev/sda1
)space for the instance type, eg 825gb in my m2.2xlarge case)
df -h
output in step 1) [potentially not needed]stopping all the root services etc like a boss : )
修改卷大小。从 AWS 控制台,您可以修改卷的大小。
Modify volume size. From AWS Console, you can modify the size of a volume.
df -h
我有一个解决方案,伙计们 yippeeee
假设您使用的是 Linux AMI,在您的情况下,您有一个简单的方法来增加文件系统的大小:
1) 停止实例
2) 分离根卷
3) 快照卷
4)使用新大小从快照创建新卷
5) 将新卷附加到原始卷所在位置的实例
6) 启动实例,停止除 ssh 之外的所有服务,并将根文件系统设置为只读
7) 放大文件系统(例如使用 resize2fs)和/或分区(如果需要)
8) 重新启动
作为替代方案,您还可以启动一个新实例并映射实例存储,或者您可以结合前面的两个步骤创建一个新的 ami。
I got a solution guys yippeeee
Assuming that you are using a linux AMI, in your case you have an easy method for increasing the size of the file system:
1) Stop the instance
2) Detach the root volume
3) Snapshot the volume
4) Create a new volume from the snapshot using the new size
5) Attach the new volume to the instance on the same place where the original one was
6) Start the instance, stop all services except ssh and set the root filesystem read only
7) Enlarge the filesystem (using for example resize2fs) and or the partition if needed
8) Reboot
As an alternative you can also launch a new instance and map the instance storage or you can create a new ami combining the two previous steps.
du -a | sort -n
我跳过了所有分离/快照/新卷的内容...只是调整了大小。
I skipped all the detach/snapshot/new volume stuff... just did the resize.
不确定 AWS 是否添加了额外的步骤以扩展添加的磁盘空间,但以下命令对我有用:
按照答案直到社区 wiki 第 6 步
步骤 7 的发布步骤如下:
输出:
输出:
参考
Not sure if AWS has added additional steps inorder to extend the added disk space but the below commands worked for me:
Follow the answer till the community wiki Step 6
Post that for Step 7 follow the steps as below:
Output:
Output:
Reference
我将该磁盘安装在另一个 EC2 实例上,在该实例上我可以成功使用 Growthpart,然后调整 size2fs。之后安装回原始 EC2 实例。
I mounted the disk on another EC2 instance where I could successfully use growpart and then resize2fs. After that mounting back to the origin EC2 instance.
当 EC2 实例是从“EBS-Store”而不是“Instance-Store”创建时,您的情况有效。从“instance-store”创建的 EC2 实例将始终为 /mnt 目录分配巨大的空间(大约 200GB 以上)。
否则,您的解决方案对于从“EBS-Store”创建的那些 EC2 机器有效。您可以使用此类机器做更多事情。
Your case is valid when the EC2 instance was created from "EBS-Store" rather than "Instance-Store". EC2 instance created from "instance-store" will always have a huge space (around 200GB +) allocated for /mnt directory.
Otherwise your solution is valid for those EC2 machine created from "EBS-Store". You can do more with such machines.
如果您遇到此错误
并且您正在使用 Docker 容器,您可以使用以下命令清理您的 EC2 实例:
If you got this error
And you are using Docker containers, you can clean your EC2 instance with these commands: