gpt4 book ai didi

amazon-web-services - 附加在 sda 上的 EC2 存储是/dev/xvde1 无法调整大小

转载 作者:太空宇宙 更新时间:2023-11-03 17:12:53 24 4
gpt4 key购买 nike

我在 EC2 实例上安装了 cPanel 和 WHm。

EC2 EBS 卷是 100GBCentOS 6 x86_64 (2014_09_29) EBS pv-1-adc4348e-1dc3-41df-b833-e86ba57a33d6-ami-809020e8.2 (ami-bc8131d4)

这是 df -h 显示的内容:

Filesystem      Size  Used Avail Use% Mounted on
/dev/xvde1 7.8G 6.6G 834M 89% /
tmpfs 3.7G 0 3.7G 0% /dev/shm
/usr/tmpDSK 485M 11M 449M 3% /tmp

EBS挂载在/dev/sda

我正在尝试增加 xvde1 的大小以几乎填满 100GB

当我运行 resize2fs/dev/xvde1 时,我得到了这个:

root@vs1 [~]# resize2fs /dev/xvde1
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 2096896 blocks long. Nothing to do!

我已经尝试过此处所述的解决方案:EC2 Can't resize volume after increasing size

但是当我重新启动实例时,它会卡在 1/2 Status Checks

我看到一些声明在 16 上启动分区并且还使用与原始配置中相同的启动。这没有用。

这里有一些更多的信息和我尝试过的其他东西:

root@vs1 [~]# resize2fs /dev/xvde1
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 2096896 blocks long. Nothing to do!

root@vs1 [~]# resize2fs /dev/xvde
resize2fs 1.41.12 (17-May-2010)
resize2fs: Device or resource busy while trying to open /dev/xvde
Couldn't find valid filesystem superblock.
root@vs1 [~]# resize2fs /dev/xvde1
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 2096896 blocks long. Nothing to do!

root@vs1 [~]# resize2fs /dev/xvde1 +25G
resize2fs 1.41.12 (17-May-2010)
The containing partition (or device) is only 2096896 (4k) blocks.
You requested a new size of 6553600 blocks.

root@vs1 [~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvde1 7.8G 6.6G 834M 89% /
tmpfs 3.7G 0 3.7G 0% /dev/shm
/usr/tmpDSK 485M 11M 449M 3% /tmp
root@vs1 [~]# resize2fs /dev/xvde1 +15g
resize2fs 1.41.12 (17-May-2010)
The containing partition (or device) is only 2096896 (4k) blocks.
You requested a new size of 3932160 blocks.

root@vs1 [~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvde1 7.8G 6.6G 834M 89% /
tmpfs 3.7G 0 3.7G 0% /dev/shm
/usr/tmpDSK 485M 11M 449M 3% /tmp

root@vs1 [~]# resize2fs /dev/xvde1
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 2096896 blocks long. Nothing to do!

root@vs1 [~]# fdisk -l

Disk /dev/xvde: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00098461

Device Boot Start End Blocks Id System
/dev/xvde1 * 1 1045 8387584 83 Linux
root@vs1 [~]# Write failed: Broken pipe

这是耗时 18 小时的完整构建的最后一步。

我可能只是神志不清。我们将不胜感激任何帮助!

编辑:

服务器上的系统日志是这样的,不知道有没有帮助:

Thread "main": pointer: 0x21e0003760, stack: 0x3740000
"main" "root=/dev/sda" "ro" "4"
vbd 2048 is hd0
******************* BLKFRONT for device/vbd/2048 **********


backend at /local/domain/0/backend/vbd/60/2048
209715200 sectors of 512 bytes
**************************
[H[J

GNU GRUB version 0.97 (7864320K lower / 0K upper memory)



[m[4;2H+-------------------------------------------------------------------------+[5;2H|[5;76H|[6;2H|[6;76H|[7;2H|[7;76H|[8;2H|[8;76H|[9;2H|[9;76H|[10;2H|[10;76H|[11;2H|[11;76H|[12;2H|[12;76H|[13;2H|[13;76H|[14;2H|[14;76H|[15;2H|[15;76H|[16;2H|[16;76H|[17;2H+-------------------------------------------------------------------------+[m

Use the ^ and v keys to select which entry is highlighted.

Press enter to boot the selected OS, 'e' to edit the

commands before booting, or 'c' for a command-line.[5;78H [m[7m[5;3H CentOS (2.6.32-504.el6.x86_64) [5;75H[m[m[6;3H CentOS (2.6.32-431.29.2.el6.x86_64) [6;75H[m[m[7;3H [7;75H[m[m[8;3H [8;75H[m[m[9;3H [9;75H[m[m[10;3H [10;75H[m[m[11;3H [11;75H[m[m[12;3H [12;75H[m[m[13;3H [13;75H[m[m[14;3H [14;75H[m[m[15;3H [15;75H[m[m[16;3H [16;75H[m[16;78H [5;75H[23;4H The highlighted entry will be booted automatically in 1 seconds. [5;75H[H[J Booting 'CentOS (2.6.32-504.el6.x86_64)'



root (hd0,0)

Filesystem type is ext2fs, partition type 0x83

kernel /boot/vmlinuz-2.6.32-504.el6.x86_64 ro root=LABEL=_ console=ttyS0,115200

crashkernel=no SYSFONT=latarcyrheb-sun16 LANG=en_US.UTF-8 KEYTABLE=us

initrd /boot/initramfs-2.6.32-504.el6.x86_64.img



============= Init TPM Front ================
Tpmfront:Error Unable to read device/vtpm/0/backend-id during tpmfront initialization! error = ENOENT
Tpmfront:Info Shutting down tpmfront

最佳答案

在通过“resize2fs”命令调整文件系统大小之前,您应该首先调整分区大小:

让我们列出连接到我们盒子的 block 设备:

lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 16G 0 disk
└─xvda1 202:1 0 8G 0 part /

如您所见,/dev/xvda1 在 16 GiB 设备上只有 8 GiB 分区,卷上没有其他分区。


步骤 1) 我们将使用“growpart”将 8G 分区调整为 16G:

# install "cloud-guest-utils" if it is not installed already
apt install cloud-guest-utils

# resize partition
growpart /dev/xvda 1

我们来看一下结果(可以看到/dev/xvda1 现在是 16G):

lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 16G 0 disk
└─xvda1 202:1 0 16G 0 part /

许多 SO 答案建议使用 fdisk 删除/重新创建分区,这是一个令人讨厌、有风险、容易出错的过程,尤其是当我们更改引导驱动器时。


step-2) 调整文件系统大小以充分利用新的分区空间
# Check before resizing ("Avail" shows 1.1G):
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.8G 6.3G 1.1G 86% /

# resize filesystem
resize2fs /dev/xvda1

# Check after resizing ("Avail" now shows 8.7G!-):
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 16G 6.3G 8.7G 42% /

顺便说一句,不再需要停止实例并分离 EBS 卷来调整它的大小! 2017 年 2 月 13 日亚马逊宣布:“Amazon EBS Update – New Elastic Volumes Change Everything”查看我的其他 SO answer了解详情。

更新:当 XFS 文件系统时使用 sudo xfs_growfs/dev/xvda1 而不是 resize2fs

关于amazon-web-services - 附加在 sda 上的 EC2 存储是/dev/xvde1 无法调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26770655/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com