我希望能够“可能”增加EC2实例的/ var文件系统的大小,而不必分离卷,创建新的卷并附加。
[ { "name": "Michael Bruce", "gender": "Male", "designation": "System Architect" }, { "name": "Jennifer Winters", "gender": "Female", "designation": "Senior Programmer" }, { "name": "Donna Fox", "gender": "Female", "designation": "Office Manager" } ]
$ df -h
$lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 2.4T 0 disk
├─xvda1 202:1 0 487M 0 part /boot
└─xvda2 202:2 0 2T 0 part
├─ami-home 253:0 0 10G 0 lvm /home
├─ami-opt 253:1 0 20G 0 lvm /opt
├─ami-tmp 253:2 0 10G 0 lvm /tmp
├─ami-var 253:3 0 30G 0 lvm /var
├─ami-var_tmp 253:4 0 10G 0 lvm /var/tmp
├─ami-var_log 253:5 0 30G 0 lvm /var/log
├─ami-var_log_audit 253:6 0 20G 0 lvm /var/log/audit
└─ami-root 253:7 0 19.5G 0 lvm /
$ aws ec2 describe-volumes --volume-ids vol-007310f0c754b2598
Filesystem Size Used Avail Use% Mounted on /dev/mapper/ami-root 20G 1.8G 18G 9% / devtmpfs 7.8G 0 7.8G 0% /dev tmpfs 7.8G 0 7.8G 0% /dev/shm tmpfs 7.8G 17M 7.8G 1% /run tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/mapper/ami-var 30G 30G 53M 100% /var /dev/mapper/ami-opt 20G 330M 20G 2% /opt /dev/mapper/ami-home 10G 39M 10G 1% /home /dev/mapper/ami-var_log 30G 72M 30G 1% /var/log /dev/mapper/ami-tmp 10G 54M 10G 1% /tmp /dev/mapper/ami-var_log_audit 20G 488M 20G 3% /var/log/audit /dev/mapper/ami-var_tmp 10G 33M 10G 1% /var/tmp /dev/xvda1 484M 162M 323M 34% /boot tmpfs 1.6G 0 1.6G 0% /run/user/1000
增加分区的大小
$ aws ec2 Modify-volume --region us-east-1 --volume-id vol-007310f0c754b2598 --size 2400 --volume-type gp2
结果:
> {
> "Volumes": [
> {
> "AvailabilityZone": "us-east-1c",
> "Attachments": [
> {
> "AttachTime": "2018-08-02T15:47:47.000Z",
> "InstanceId": "i-047fa3b2aea60f7b3",
> "VolumeId": "vol-007310f0c754b2598",
> "State": "attached",
> "DeleteOnTermination": true,
> "Device": "/dev/xvda"
> }
> ],
> "Encrypted": false,
> "VolumeType": "gp2",
> "VolumeId": "vol-007310f0c754b2598",
> "State": "in-use",
> "Iops": 720,
> "SnapshotId": "snap-00a77e9f750429974",
> "CreateTime": "2018-08-02T15:47:47.023Z",
> "Size": 240
> }
> ] }
}
错误:数据大小未更改,正在跳过
参考:
所以我尝试了:
{
"VolumeModification": {
"TargetSize": 2400,
"TargetVolumeType": "gp2",
"ModificationState": "modifying",
"VolumeId": "vol-007310f0c754b2598",
"TargetIops": 7200,
"StartTime": "2018-08-06T06:57:21.000Z",
"Progress": 0,
"OriginalVolumeType": "gp2",
"OriginalIops": 720,
"OriginalSize": 240
}
但是:
$lvextend -l +200%FREE /dev/mapper/ami-var
New size (7680 extents) matches existing size (7680 extents).
答案 0 :(得分:0)
完成上述步骤后:做