AWS: EC2 -> Instances
修改内存:
-
stop实例
Stop Instance -
此时Change Instance Type功能就可以使用了,修改成自己需要的大小,然后start实例
Change Instance Type
P.S. Instance Type: https://aws.amazon.com/cn/ec2/instance-types/
修改硬盘:
-
在实例下方找到device,点击EBS ID进入实例对应的Volume中
Device -
修改Volume大小保存即可
Actions
接下来的一步容易被忽略,其实此时还没有完全修改成功!
- 进入服务,运行以下命令:
ubuntu@ip-172-31-16-253:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.9G 0 7.9G 0% /dev
tmpfs 1.6G 8.8M 1.6G 1% /run
/dev/xvda1 7.7G 7.7G 0 100% /
tmpfs 7.9G 0 7.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
/dev/loop0 26M 26M 0 100% /snap/heroku/3984
/dev/loop1 97M 97M 0 100% /snap/core/9804
/dev/loop2 29M 29M 0 100% /snap/amazon-ssm-agent/2012
/dev/loop3 98M 98M 0 100% /snap/core/9993
tmpfs 1.6G 0 1.6G 0% /run/user/1000
ubuntu@ip-172-31-16-253:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 40G 0 disk
└─xvda1 202:1 0 8G 0 part /
loop0 7:0 0 25.5M 1 loop /snap/heroku/3984
loop1 7:1 0 96.6M 1 loop /snap/core/9804
loop2 7:2 0 28.1M 1 loop /snap/amazon-ssm-agent/2012
loop3 7:3 0 97.1M 1 loop /snap/core/9993
ubuntu@ip-172-31-16-253:~$ sudo growpart /dev/xvda 1
CHANGED: partition=1 start=2048 old: size=16775135 end=16777183 new: size=83883999,end=83886047
ubuntu@ip-172-31-16-253:~$ sudo resize2fs /dev/xvda1
resize2fs 1.42.13 (17-May-2015)
Filesystem at /dev/xvda1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 3
The filesystem on /dev/xvda1 is now 10485499 (4k) blocks long.
ubuntu@ip-172-31-16-253:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.9G 0 7.9G 0% /dev
tmpfs 1.6G 8.8M 1.6G 1% /run
/dev/xvda1 39G 1.5G 38G 4% /
tmpfs 7.9G 0 7.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
/dev/loop0 26M 26M 0 100% /snap/heroku/3984
/dev/loop1 97M 97M 0 100% /snap/core/9804
/dev/loop2 29M 29M 0 100% /snap/amazon-ssm-agent/2012
/dev/loop3 98M 98M 0 100% /snap/core/9993
tmpfs 1.6G 0 1.6G 0% /run/user/1000
此时看到/dev/xvda1 7.7G 7.7G 0 100% /
变成了/dev/xvda1 39G 1.5G 38G 4% /
,就代表成功了!
网友评论