resize volume ebs without downtime

  Uncategorized

1. Modify volume size on aws ebs

2. Resize filesystem

df -h to see current filesystem size info

Filesystem       Size  Used Avail Use% Mounted on
/dev/root         29G   26G  3.2G  89% /
devtmpfs         1.9G     0  1.9G   0% /dev
tmpfs            1.9G     0  1.9G   0% /dev/shm
tmpfs            387M  896K  386M   1% /run
tmpfs            5.0M     0  5.0M   0% /run/lock
tmpfs            1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/loop0        25M   25M     0 100% /snap/amazon-ssm-agent/6312
/dev/loop1        56M   56M     0 100% /snap/core18/2745
/dev/loop2        64M   64M     0 100% /snap/core20/1891
/dev/loop3        92M   92M     0 100% /snap/lxd/24061
/dev/nvme0n1p15  105M  6.1M   99M   6% /boot/efi
/dev/loop4        54M   54M     0 100% /snap/snapd/19122
tmpfs            387M     0  387M   0% /run/user/1000
/dev/loop5        41M   41M     0 100% /snap/snapd/20092
/dev/loop6        25M   25M     0 100% /snap/amazon-ssm-agent/7528
/dev/loop7        56M   56M     0 100% /snap/core18/2790
/dev/loop8        64M   64M     0 100% /snap/core20/2015
tmpfs            387M     0  387M   0% /run/user/0

lsblk to see name of devive volume.

NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0          7:0    0 24.4M  1 loop /snap/amazon-ssm-agent/6312
loop1          7:1    0 55.7M  1 loop /snap/core18/2745
loop2          7:2    0 63.5M  1 loop /snap/core20/1891
loop3          7:3    0 91.9M  1 loop /snap/lxd/24061
loop4          7:4    0 53.2M  1 loop /snap/snapd/19122
loop5          7:5    0 40.9M  1 loop /snap/snapd/20092
loop6          7:6    0 24.6M  1 loop /snap/amazon-ssm-agent/7528
loop7          7:7    0 55.7M  1 loop /snap/core18/2790
loop8          7:8    0 63.5M  1 loop /snap/core20/2015
nvme0n1      259:0    0   50G  0 disk 
├─nvme0n1p1  259:1    0 29.9G  0 part /
├─nvme0n1p14 259:2    0    4M  0 part 
└─nvme0n1p15 259:3    0  106M  0 part /boot/efi

growpart /dev/nvme0n1 1 to upgrade filesystem

NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0          7:0    0 24.4M  1 loop /snap/amazon-ssm-agent/6312
loop1          7:1    0 55.7M  1 loop /snap/core18/2745
loop2          7:2    0 63.5M  1 loop /snap/core20/1891
loop3          7:3    0 91.9M  1 loop /snap/lxd/24061
loop4          7:4    0 53.2M  1 loop /snap/snapd/19122
loop5          7:5    0 40.9M  1 loop /snap/snapd/20092
loop6          7:6    0 24.6M  1 loop /snap/amazon-ssm-agent/7528
loop7          7:7    0 55.7M  1 loop /snap/core18/2790
loop8          7:8    0 63.5M  1 loop /snap/core20/2015
nvme0n1      259:0    0   50G  0 disk 
├─nvme0n1p1  259:1    0 49.9G  0 part /
├─nvme0n1p14 259:2    0    4M  0 part 
└─nvme0n1p15 259:3    0  106M  0 part /boot/efi

final, resize2fs /dev/nvme0n1p1 to apply change resize filesystem. Check by df -h to see changed.

Filesystem       Size  Used Avail Use% Mounted on
/dev/root         49G   26G   23G  54% /
devtmpfs         1.9G     0  1.9G   0% /dev
tmpfs            1.9G     0  1.9G   0% /dev/shm
tmpfs            387M  896K  386M   1% /run
tmpfs            5.0M     0  5.0M   0% /run/lock
tmpfs            1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/loop0        25M   25M     0 100% /snap/amazon-ssm-agent/6312
/dev/loop1        56M   56M     0 100% /snap/core18/2745
/dev/loop2        64M   64M     0 100% /snap/core20/1891
/dev/loop3        92M   92M     0 100% /snap/lxd/24061
/dev/nvme0n1p15  105M  6.1M   99M   6% /boot/efi
/dev/loop4        54M   54M     0 100% /snap/snapd/19122
tmpfs            387M     0  387M   0% /run/user/1000
/dev/loop5        41M   41M     0 100% /snap/snapd/20092
/dev/loop6        25M   25M     0 100% /snap/amazon-ssm-agent/7528
/dev/loop7        56M   56M     0 100% /snap/core18/2790
/dev/loop8        64M   64M     0 100% /snap/core20/2015
tmpfs            387M     0  387M   0% /run/user/0