Score:0

How can I increase Ubuntu hard drive space on AWS when resize2fs says there is nothing to do?

kz flag

I've looked at a few tutorials, they say -

Step 1) run df -h

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.7G  6.1G  1.7G  79% /
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           787M  832K  787M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/loop0       25M   25M     0 100% /snap/amazon-ssm-agent/6312
/dev/loop1       25M   25M     0 100% /snap/amazon-ssm-agent/6563
/dev/loop3       56M   56M     0 100% /snap/core18/2566
/dev/loop2       64M   64M     0 100% /snap/core20/1623
/dev/loop5       64M   64M     0 100% /snap/core20/1634
/dev/loop4       56M   56M     0 100% /snap/core18/2620
/dev/loop7       48M   48M     0 100% /snap/snapd/17029
/dev/loop6       68M   68M     0 100% /snap/lxd/22753
/dev/loop8       68M   68M     0 100% /snap/lxd/21835
/dev/loop9       48M   48M     0 100% /snap/snapd/17336
tmpfs           787M     0  787M   0% /run/user/1000

Step 2) run lsblk

$ lsblk
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 24.8M  1 loop /snap/amazon-ssm-agent/6563
loop2         7:2    0 63.2M  1 loop /snap/core20/1623
loop3         7:3    0 55.6M  1 loop /snap/core18/2566
loop4         7:4    0 55.6M  1 loop /snap/core18/2620
loop5         7:5    0 63.2M  1 loop /snap/core20/1634
loop6         7:6    0 67.8M  1 loop /snap/lxd/22753
loop7         7:7    0   48M  1 loop /snap/snapd/17029
loop8         7:8    0 67.2M  1 loop /snap/lxd/21835
loop9         7:9    0   48M  1 loop /snap/snapd/17336
nvme0n1     259:0    0   30G  0 disk
└─nvme0n1p1 259:1    0    8G  0 part /

Step 3) run blkid

$ blkid
/dev/nvme0n1p1: LABEL="cloudimg-rootfs" UUID="436cf32d-5e3d-46ca-b557-f870c8a25794" TYPE="ext4" PARTUUID="24ca9e81-01"

From here, every example online seems old, and every example has sudo resize2fs /dev/xvda1 as the example, and I can recall doing this in years past that I too had xvda1 as a Filesystem, but that is no longer the case in 2022 on a new machine

if I try to run sudo resize2fs /dev/nvme0n1p1 I get an error saying there is nothing to do

$ sudo resize2fs /dev/nvme0n1p1
resize2fs 1.45.5 (07-Jan-2020)
The filesystem is already 2096891 (4k) blocks long.  Nothing to do!

I can see the 30G that I increased my volume to on nvme0n1 but how do I get my OS to recognize the extra space now?

Score:0
hn flag

I hope you are very well.

About this exercise of resizing the file system in an EC2 Linux instance, I have some doubts.

When you ran df -hT, it shows the filesystem dev/root, type ext4

Then with the lsblk command, the nvme0n1p1 partition is displayed whose size is equal to that of the volume.

My questions are: Would it be correct to have executed the command sudo resize2fs /dev/root instead of sudo resize2fs /dev/nvme0n1p1, in which cases to execute each of them?

Thank you in advance for your answers.

Kind regards.

Score:0
kz flag

Found this tutorial https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html

ran the following commands

$ sudo growpart /dev/nvme0n1 1
CHANGED: partition=1 start=2048 old: size=16775135 end=16777183 new: size=62912479 end=62914527

was able to extend the size

$ lsblk
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 24.8M  1 loop /snap/amazon-ssm-agent/6563
loop2         7:2    0 63.2M  1 loop /snap/core20/1623
loop3         7:3    0 55.6M  1 loop /snap/core18/2566
loop4         7:4    0 55.6M  1 loop /snap/core18/2620
loop5         7:5    0 63.2M  1 loop /snap/core20/1634
loop6         7:6    0 67.8M  1 loop /snap/lxd/22753
loop7         7:7    0   48M  1 loop /snap/snapd/17029
loop8         7:8    0 67.2M  1 loop /snap/lxd/21835
loop9         7:9    0   48M  1 loop /snap/snapd/17336
nvme0n1     259:0    0   30G  0 disk
└─nvme0n1p1 259:1    0   30G  0 part /

determined the system type was ext4

$ df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/root      ext4      7.7G  6.1G  1.7G  79% /
...

then was able to resize the partition using the given command

$ sudo resize2fs /dev/nvme0n1p1
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/nvme0n1p1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 4
The filesystem on /dev/nvme0n1p1 is now 7864059 (4k) blocks long.

disk % successfully dropped enter image description here

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.