使新卷在 AWS ec2 上可用
Make new volume available on AWS ec2
我现有的卷 运行 磁盘 space。我按照这些说明基于旧卷的快照创建了一个新卷:
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
运行 磁盘 space:
$ 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 磁盘创建的 space。我想可能是这样:
nvme0n1 259:0 0 100G 0 disk
所以我的问题是如何使用这100G?这就是创建新卷的全部意义..
您可以通过使用此功能跳过增加 EBS 卷大小的漫长过程 Modify EBS Volumes。
如您所见,磁盘 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
我现有的卷 运行 磁盘 space。我按照这些说明基于旧卷的快照创建了一个新卷:
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
运行 磁盘 space:
$ 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 磁盘创建的 space。我想可能是这样:
nvme0n1 259:0 0 100G 0 disk
所以我的问题是如何使用这100G?这就是创建新卷的全部意义..
您可以通过使用此功能跳过增加 EBS 卷大小的漫长过程 Modify EBS Volumes。
如您所见,磁盘
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