Joe
Joe

Reputation: 13151

How to resize volume on EC2 - CentOS?

I created EMR on AWS and ssh to a name node. Noticed there was a space issue and increased volume in AWS console from 200GB -> 500GB.
Then rebooted instance and it is showing that there is no change:

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      197G  187G  3.1M 100% /
tmpfs            32G     0   32G   0% /dev/shm
cm_processes     32G     0   32G   0% /var/run/cloudera-scm-agent/process

Tried to check partitions and this is what is showing:

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

Then did resize2fs but is showning nothing to do:

sudo resize2fs /dev/xvda1
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 52428544 blocks long.  Nothing to do!

Size did not change.
What should I do next?

Thanks.

Upvotes: 1

Views: 1815

Answers (1)

RaGe
RaGe

Reputation: 23815

  1. Snapshot all ebs volumes you care about before doing any resize operations on them.

  2. Install growpart sudo yum install cloud-utils-growpart

  3. Resize partiongrowpart /dev/xdva 1

  4. Reboot reboot now

  5. Run lsblk and verify that the partition is now the full disk size

  6. You may still have to run sudo resize2fs /dev/xvda1 to expand the filesystem

Upvotes: 2

Related Questions