1

I created an EC2 instance with type of m1.small and later found it's lack of space. I then stop the instance and change the type to m1.xlarge. However, I have no luck on getting more space.

df -a shows as below:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/xvde1             5905712   5694380    151336  98% /
none                         0         0         0   -  /proc
none                         0         0         0   -  /sys
none                         0         0         0   -  /dev/pts
none                   7685872         0   7685872   0% /dev/shm
none                         0         0         0   -  /proc/sys/fs/binfmt_misc
sunrpc                       0         0         0   -  /var/lib/nfs/rpc_pipefs

Observing that there are 7G space at /dev/shm with no filesystem mounted, I wonder if there's any way to "borrow" this to /dev/xvde1.

  • Are you using EBS? – horte Sep 26 '12 at 09:43
  • There's only one volume for the instance. I guess you are asking extra EBS disk. –  Sep 26 '12 at 10:00
  • I'm confused that since it's m1.xlarge instance type which should have more than the displayed size, how come it still shows as 5G for /dev/xvde1? –  Sep 26 '12 at 10:54
  • 1
    Anyhow, I suggest you to not choose instance size based on how much disk space you need. Instead I suggest you to start an EBS backed instance and create a volume with the needed size. Then you can have as much disk space you want. – horte Sep 26 '12 at 13:45

2 Answers2

3

The m1.small and m1.xlarge instance sizes you are referring to is the size of the CPU power, the RAM memory, number of cores, processor, etc. Not the actual drive. The size of your drive is found not in the type, but in the EBS volume. You want to enlarge your EBS volume to get more disk space.

Here are my notes to resize a partition in Amazon EBS console:

  1. Stop server
  2. Create an EBS snapshot
  3. Add new volume with more space
  4. Create using the snapshot you just made
  5. Attach and mount the new ebs volume as /dev/sda1 (for boot)
  6. Run sudo resize2fs /dev/xvda1 - for the actual resizing.
1

How to nudge up file size for /dev/xvda1 on AWS EC2. You can view file size usage with; $ df -h (mine shows 100% use). You can reboot the system ($ sudo reboot) to release any deleted files processes may be holding onto but if you still need more space you will need to increase your EBS volume.

  1. Go to EBS Volumes: enter image description here
  2. Modify volume: enter image description here
  3. Nudge up volume size. I'm increasing to 16GB from 8GB. Change yours then click modify.enter image description here
  4. Wait for optimization to complete. Took about 1 hr for me. enter image description here
  5. Check new file size using command: lsblk

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

  1. Increase volume of xvda1: sudo growpart /dev/xvda 1

CHANGED: partition=1 start=2048 old: size=16775135 end=16777183 new: size=33552351,end=33554399

  1. check it again: $ lsblk

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

  1. last resize file system: $ sudo resize2fs /dev/xvda1

We can see it now doubles our space:

/dev/xvda1 7.7G 7.7G 24M 100% /

/dev/xvda1 16G 7.7G 7.8G 50% /

Note: I found this reference helpful: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html

Brian Bird
  • 111
  • 3