gpt4 book ai didi

linux - 在 AWS ec2 上提供新卷

转载 作者:行者123 更新时间:2023-12-04 18:44:09 25 4
gpt4 key购买 nike

关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。












我们不允许在 Stack Overflow 上提出有关专业服务器或网络相关基础设施管理的问题。您可以编辑问题,使其成为 on-topic对于堆栈溢出。


2年前关闭。







Improve this question




我现有的卷用完了磁盘空间。我按照这些说明根据旧卷的快照创建了一个新卷:

Log into the AWS Management Console

Make sure that the Instance that you wish to change is not currently running

Navigate to Elastic Block Store > Volumes

Check the box next to the Volume that needs more space

Click the More… drop down list and select Create Snapshot

Enter a Name and a Description

Navigate to Elastic Block Store> Snapshots

Monitor the progress of the Snapshot for completion

Once complete, navigate back to Elastic Block Store > Volumes

Click Create Volume

Enter the desired size for the new volume

Make sure that you select the same Availability Zone for your instance

Select the Snapshot that you just created

Click Yes, Create

Monitor the progress of the Volume for completion

Once complete, Check the box next to the Volume that is currently connected to the Instance

Make sure that no other Volumes are selected

Click the More… drop down list and select Click the More… drop down list and select Detach Volume

Uncheck the box selected and check the box next to the new Volume

Click the More… drop down list and select Click the More… drop down list and select Attach Volume

Select the Instance that you wish to change

Change the value in Device from xvdf to /dev/sda1

Click Yes, Attach

Navigate to Instances and start your Instance

Once you are satisfied that the volume works, feel free to delete the Snapshot and old Volume if you like



遵循这些确切说明后,我登录到 ec2 实例并注意到以下内容:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 18M 1 loop /snap/amazon-ssm-agent/1480
loop1 7:1 0 93.8M 1 loop /snap/core/8935
loop2 7:2 0 18M 1 loop /snap/amazon-ssm-agent/1566
loop3 7:3 0 91.4M 1 loop /snap/core/8689
nvme0n1 259:0 0 100G 0 disk
└─nvme0n1p1 259:1 0 8G 0 part /

设备 nvme0n1p1是磁盘空间不足的那个:
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 390M 16M 375M 4% /run
/dev/nvme0n1p1 7.7G 7.7G 0 100% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/loop0 18M 18M 0 100% /snap/amazon-ssm-agent/1480
/dev/loop1 94M 94M 0 100% /snap/core/8935
/dev/loop3 92M 92M 0 100% /snap/core/8689
/dev/loop2 18M 18M 0 100% /snap/amazon-ssm-agent/1566
tmpfs 390M 0 390M 0% /run/user/1000

新卷是用 100GB 的磁盘空间创建的。我想可能是这样的:
nvme0n1     259:0    0  100G  0 disk 

所以我的问题是如何利用这 100G?这就是创建新卷的重点..

最佳答案

通过使用此功能 Modify EBS Volumes,您可以跳过增加 EBS 卷大小的漫长过程。 .

如您所见,磁盘 nvme0n1新大小为 100G ,但根分区仍然是8G .根分区nvme0n1p1必须扩展并且必须调整其文件系统的大小。

1. 扩展分区

growpart /dev/nvme0n1 1
1表示分区号,即 nvme0n1p1 .

如果 growpart命令不存在,使用 apt install cloud-guest-utils 安装

2. 调整文件系统大小

对于 xfs ,
xfs_growfs -d /

如果是 ext文件系统,
resizefs /dev/nvme0n1p1

关于linux - 在 AWS ec2 上提供新卷,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61162003/

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