EC2 增加大小后无法调整卷大小 [英] EC2 Can't resize volume after increasing size
问题描述
我已按照调整 EC2 卷大小的步骤进行操作
- 停止实例
- 拍摄当前卷的快照
- 在同一个区域中从上一个快照创建一个更大的新卷
- 从实例中分离旧卷
- 将新卷附加到同一挂载点的实例
旧卷是 5GB 而我创建的卷是 100GB现在,当我重新启动实例并运行 df -h I
仍然看到这个
已使用的文件系统大小 Avail Use% Mounted on/dev/xvde1 4.7G 3.5G 1021M 78%/tmpfs 296M 0 296M 0%/dev/shm
这是我运行时得到的
sudo resize2fs/dev/xvde1文件系统已经有 1247037 个块长.没事做!
如果我运行 cat/proc/partitions
我看到
202 64 104857600 xvde202 65 4988151 xvde1202 66 249007 xvde2
据我所知,如果我遵循了正确的步骤,xvde 应该具有与 xvde1 相同的数据,但我不知道如何使用它
如何使用新卷或卸载 xvde1 并挂载 xvde?p>
我无法理解我做错了什么
我也试过 sudo ifs_growfs/dev/xvde1
xfs_growfs:/dev/xvde1 不是挂载的 XFS 文件系统
顺便说一句,这是一个带有 centos 6.2 x86_64 的 linux 机器
预先感谢您的帮助
谢谢 Wilman,你的命令工作正常,如果我们将 EBS 增加到更大的尺寸,需要考虑一些小的改进
- 停止实例
- 从卷创建快照
- 根据增加大小的快照创建新卷
- 检查并记住当前的卷挂载点(即
/dev/sda1
) - 分离当前音量
- 将最近创建的卷附加到实例,设置确切的挂载点
- 重启实例
通过 SSH 访问实例并运行
fdisk/dev/xvde
警告:不推荐使用 DOS 兼容模式.强烈建议关闭模式(命令c")并将显示单位更改为扇区(命令u")
点击p显示当前分区
- 点击d删除当前分区(如果有多个,你必须一次删除一个)注意:不要担心数据不会丢失
- 点击n创建一个新分区
- 点击 p 将其设置为主
- 点击1设置第一个圆柱
- 设置所需的新空间(如果为空则保留整个空间)
- 点击 a 使其可启动
- 点击 1 和 w 写入更改
- 重启实例或使用
partprobe
(来自parted
包)将新的分区表告诉内核 - 通过 SSH 登录并运行 resize2fs/dev/xvde1
- 最后检查运行df -h的新空间
I have followed the steps for resizing an EC2 volume
- Stopped the instance
- Took a snapshot of the current volume
- Created a new volume out of the previous snapshot with a bigger size in the same region
- Deattached the old volume from the instance
- Attached the new volume to the instance at the same mount point
Old volume was 5GB and the one I created is 100GB
Now, when i restart the instance and run df -h I
still see this
Filesystem Size Used Avail Use% Mounted on
/dev/xvde1 4.7G 3.5G 1021M 78% /
tmpfs 296M 0 296M 0% /dev/shm
This is what I get when running
sudo resize2fs /dev/xvde1
The filesystem is already 1247037 blocks long. Nothing to do!
If I run cat /proc/partitions
I see
202 64 104857600 xvde
202 65 4988151 xvde1
202 66 249007 xvde2
From what I understand if I have followed the right steps xvde should have the same data as xvde1 but I don't know how to use it
How can I use the new volume or umount xvde1 and mount xvde instead?
I cannot understand what I am doing wrong
I also tried sudo ifs_growfs /dev/xvde1
xfs_growfs: /dev/xvde1 is not a mounted XFS filesystem
Btw, this a linux box with centos 6.2 x86_64
Thanks in advance for your help
Thank you Wilman your commands worked correctly, small improvement need to be considered if we are increasing EBSs into larger sizes
- Stop the instance
- Create a snapshot from the volume
- Create a new volume based on the snapshot increasing the size
- Check and remember the current's volume mount point (i.e.
/dev/sda1
) - Detach current volume
- Attach the recently created volume to the instance, setting the exact mount point
- Restart the instance
Access via SSH to the instance and run
fdisk /dev/xvde
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u')
Hit p to show current partitions
- Hit d to delete current partitions (if there are more than one, you have to delete one at a time) NOTE: Don't worry data is not lost
- Hit n to create a new partition
- Hit p to set it as primary
- Hit 1 to set the first cylinder
- Set the desired new space (if empty the whole space is reserved)
- Hit a to make it bootable
- Hit 1 and w to write changes
- Reboot instance OR use
partprobe
(from theparted
package) to tell the kernel about the new partition table - Log via SSH and run resize2fs /dev/xvde1
- Finally check the new space running df -h
这篇关于EC2 增加大小后无法调整卷大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!