克隆后增加EC2 EBS容量-resize2fs无法正常工作 [英] increase EC2 EBS volume after cloning - resize2fs not working

查看:780
本文介绍了克隆后增加EC2 EBS容量-resize2fs无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这与 EC2增大后无法调整大小的问题非常相似大小.但是,我无法使用fdisk手动解决此问题,因为我试图使整个过程自动运行.

This is a very similar problem to EC2 Can't resize volume after increasing size. However, I cannot resolve this manually using fdisk because I'm trying to get the whole process to run automatically.

我正在使用python boto(2.39)脚本(代码段)快照,使用相同的块设备映射注册一个新的AMI,然后从中创建一个实例.

I'm using a python boto (2.39) script (snippet) which takes a snapshot, registers a new AMI with the same block device mapping, and then creates an instance from it.

一切正常.将创建具有更大卷大小的新实例.新实例加载正常.我看到的唯一问题是分区大小保持为原始大小,而不是完整大小.

It's all working well. The new instance is created with a larger volume size. The new instance is loading ok. The only problem I see is that the partition size is kept at the original size instead of the full size.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      7.8G  2.4G  5.0G  33% /

当我运行resize2fs时,它什么也没做

when I run resize2fs it doesn't do anything

$ resize2fs /dev/xvda1
resize2fs 1.42.12 (29-Aug-2014)
The filesystem is already 2096128 (4k) blocks long.  Nothing to do!

是否有一种方法可以自动(脚本化)来解决此问题,或者在克隆图像时可以执行某些操作?我使用的不是Amazon Linux AMI,而是基于debian的AMI.

Is there a way to run something automatically (scripted) to fix this, or something to do when cloning the image? I'm not using Amazon Linux AMI but rather a debian-based AMI.

推荐答案

Amazon Linux将自动将根文件系统调整为卷的完整大小.这是在 Amazon Linux AMI 2014.03 中引入的.

Amazon Linux will automatically resize the root filesystem to the full size of the volume. This was introduced in Amazon Linux AMI 2014.03.

发行说明:

Cloud-Init 0.7.2

Cloud-Init已更新至0.7系列,添加了许多有用的功能.一个示例是dracut-modules-growroot,它会在启动时自动调整根文件系统的大小.

Cloud-Init has been updated to the 0.7 series, adding a number of useful features. One example is dracut-modules-growroot, which automatically resizes your root filesystem on boot.

这篇关于克隆后增加EC2 EBS容量-resize2fs无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆