How To Expand an EBS Volume After a Disk Resize on Amazon Linux
First, use the AWS Console to modify the volume to the desired size, in our example we want to go from 10GB to 25GB for the root filesystem For a Xen ext4 root volume
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 9.8G 9.6G 26M 100% / /dev/xvdf 200G 99G 102G 50% /volumes/data # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 10G 0 disk └─xvda1 202:1 0 10G 0 part / xvdf 202:80 0 200G 0 disk /volumes/data # growpart /dev/xvda 1 CHANGED: disk=/dev/xvda partition=1: start=4096 old: size=20967390,end=20971486 new: size=52424670,end=52428766 # lsblk lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 25G 0 disk └─xvda1 202:1 0 25G 0 part / xvdf 202:80 0 200G 0 disk /volumes/data # resize2fs /dev/xvda1 resize2fs 1.43.5 (04-Aug-2017) Filesystem at /dev/xvda1 is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 2 The filesystem on /dev/xvda1 is now 6553083 (4k) blocks long. # df -hT Filesystem Type Size Used Avail Use% Mounted on /dev/xvda1 ext4 25G 9.6G 15G 40% / /dev/xvdf xfs 200G 99G 102G 50% /volumes/data |
For NVMe First, use lsblk to see the raw partitions:
1 2 3 4 5 6 7 8 9 |
# df -hT Filesystem Type Size Used Avail Use% Mounted on /dev/nvme0n1p1 xfs 20G 2.8G 18G 14% / # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT nvme0n1 259:0 0 40G 0 disk ├─nvme0n1p1 259:1 0 20G 0 part / └─nvme0n1p128 259:2 0 1M 0 part |
Note how the partition at 259:1 is only 20GB, […]