首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法调整AWS EC2卷的大小

无法调整AWS EC2卷的大小
EN

Stack Overflow用户
提问于 2017-03-11 15:53:17
回答 2查看 1.4K关注 0票数 0

我创建了一个8 8GB根卷的AWS EC2 Linux实例。然后我将EBS卷增加到9 9GB,它就进入了完成状态。这是一个很小的体积,所以调整大小需要几分钟才能完成。

现在,在使用前面提到的here指令调整卷大小之后,我尝试扩展linux文件系统。但是,我得到了下面的错误消息。我试了两次,整个过程。但这都是一样的。

代码语言:javascript
运行
复制
The filesystem is already 2096635 (4k) blocks long.  Nothing to do!

这是该图像的屏幕截图。

有人能帮我吗?

EN

回答 2

Stack Overflow用户

发布于 2017-03-12 16:25:43

只需重启实例,因为它会在引导时自动调整根文件系统的大小。

我自己也试过。下面是一个8 8GB的实例:

代码语言:javascript
运行
复制
[ec2-user@ip-172-31-15-216 ~]$ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0   8G  0 disk 
└─xvda1 202:1    0   8G  0 part /

[ec2-user@ip-172-31-15-216 ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        236M   56K  236M   1% /dev
tmpfs           246M     0  246M   0% /dev/shm
/dev/xvda1      7.8G  985M  6.7G  13% /

修改EBS卷后:

代码语言:javascript
运行
复制
[ec2-user@ip-172-31-15-216 ~]$ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0   9G  0 disk 
└─xvda1 202:1    0   8G  0 part /

[ec2-user@ip-172-31-15-216 ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        236M   56K  236M   1% /dev
tmpfs           246M     0  246M   0% /dev/shm
/dev/xvda1      7.8G  985M  6.7G  13% /

重新启动后:

代码语言:javascript
运行
复制
[ec2-user@ip-172-31-15-216 ~]$ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0   9G  0 disk 
└─xvda1 202:1    0   9G  0 part /

[ec2-user@ip-172-31-15-216 ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        236M   56K  236M   1% /dev
tmpfs           246M     0  246M   0% /dev/shm
/dev/xvda1      8.8G  984M  7.7G  12% /

另请参阅:increase EC2 EBS volume after cloning - resize2fs not working

票数 3
EN

Stack Overflow用户

发布于 2017-03-11 17:16:14

代码语言:javascript
运行
复制
# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/storage_expand_partition.html
# Before goging to do this, detach and attach the root volume to anothe instance
# Note:
#   1) Before detach the volume, please make a note of device name which going to
#      detch from the machine, why because we should mention same name when attaching back, otherwise data will be lost
#   2)

# Identifying device name which we want to expand
lsblk

# Running parted command on the device
sudo parted /dev/xvdf

# Changing the parted units of measure to sectors.
unit s

# Run the print command to list the partitions on the device
print
# if it shows warning, chose fix

# Delete the partition entry for the partition using the number (1) from the previous step
rm 1 # number 1 will change based the partition we want to delete

# Create a new partition that extends to the end of the volume
mkpart Linux 4096s 100%

# Run the print command again to verify your partition
print

# Check to see that any flags that were present earlier are still
# present for the partition that you expanded. In some cases the boot
# flag may be lost. If a flag was dropped from the partition when it was expanded,
# add the flag with the following command, substituting your partition number and the flag name.
# For example, the following command adds the boot flag to partition 1
set 1 boot on

#Run the quit command to exit parted.
quit

# verfiying the device
sudo e2fsck -f /dev/xvdf1
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42732786

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档