1

I am running out of space on the hard drive I am using for an AWS Ubuntu instance.

df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            488M     0  488M   0% /dev
tmpfs           100M   12M   88M  12% /run
/dev/xvda1      7.7G  7.3G  439M  95% /
tmpfs           496M     0  496M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           496M     0  496M   0% /sys/fs/cgroup
tmpfs           100M     0  100M   0% /run/user/1000

The lsblk command shows that I have a partition of 8gb on a 20gb volume.

lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  20G  0 disk 
└─xvda1 202:1    0   8G  0 part /

When I try to extend the partition, I get an error saying it is already max size (2096891 * 4096 = 8.5gib).

sudo resize2fs /dev/xvda1
resize2fs 1.42.13 (17-May-2015)
The filesystem is already 2096891 (4k) blocks long.  Nothing to do!

I don't think I need to extend the physical volume, but do I need to extend the logical volume? How can I get the partition to use more of the 20 gb volume?

1 Answer 1

0

So the full steps are :

  1. Extend the physical volume in AWS to 20 gb.

  2. Determine if the file system is ext3/ext4 or xfs.

    sudo file -sL /dev/xvda1

    /dev/xvda1: Linux rev 1.0 ext4 filesystem data, UUID=1233211232132123123, volume name "myig-roots" (needs journal recovery) (extents) (large files) (huge files)

  3. In this case it is a ext4 files system, so we use grow part

    sudo growpart /dev/xvda 1

Now the partition is extended:

lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  20G  0 disk 
└─xvda1 202:1    0  20G  0 part /

Here's a link to something very similar.

1
  • I suggest you explain why this is in your answer. E.g., something along the lines of there being two steps: (1) expand partition; (2) expand filesystem Commented Oct 8, 2019 at 20:34

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.