Skip to content

Instantly share code, notes, and snippets.

@mommi84 mommi84/extend.sh
Created Sep 10, 2019

Embed
What would you like to do?
Extend Ubuntu SSD in AWS
# After having extended the SSD size via AWS console:
ubuntu@ip-172-31-46-157:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop1 7:1 0 18M 1 loop /snap/amazon-ssm-agent/1455
loop2 7:2 0 88.7M 1 loop /snap/core/7396
loop3 7:3 0 89M 1 loop /snap/core/7713
xvda 202:0 0 100G 0 disk
└─xvda1 202:1 0 50G 0 part /
ubuntu@ip-172-31-46-157:~$ sudo growpart /dev/xvda 1
CHANGED: partition=1 start=2048 old: size=104855519 end=104857567 new: size=209713119,end=209715167
ubuntu@ip-172-31-46-157:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop1 7:1 0 18M 1 loop /snap/amazon-ssm-agent/1455
loop2 7:2 0 88.7M 1 loop /snap/core/7396
loop3 7:3 0 89M 1 loop /snap/core/7713
xvda 202:0 0 100G 0 disk
└─xvda1 202:1 0 100G 0 part /
ubuntu@ip-172-31-46-157:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 0 2.0G 0% /dev
tmpfs 395M 780K 394M 1% /run
/dev/xvda1 49G 17G 33G 34% /
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/loop1 18M 18M 0 100% /snap/amazon-ssm-agent/1455
/dev/loop2 89M 89M 0 100% /snap/core/7396
tmpfs 395M 0 395M 0% /run/user/1000
/dev/loop3 90M 90M 0 100% /snap/core/7713
ubuntu@ip-172-31-46-157:~$ sudo resize2fs /dev/xvda1
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/xvda1 is mounted on /; on-line resizing required
old_desc_blocks = 7, new_desc_blocks = 13
The filesystem on /dev/xvda1 is now 26214139 (4k) blocks long.
ubuntu@ip-172-31-46-157:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 0 2.0G 0% /dev
tmpfs 395M 780K 394M 1% /run
/dev/xvda1 97G 17G 81G 17% /
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/loop1 18M 18M 0 100% /snap/amazon-ssm-agent/1455
/dev/loop2 89M 89M 0 100% /snap/core/7396
tmpfs 395M 0 395M 0% /run/user/1000
/dev/loop3 90M 90M 0 100% /snap/core/7713
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.