I have an EC2 instance which I created a 500GB EBS volume for. Unfortunately, the EC2 instance shows only 8GB available.
I have only one drive, which is right.
[root@ip-10-244-134-250 ~]# ls -la /dev/x*
brw-rw---- 1 root disk 202, 1 Aug 7 08:54 /dev/xvda1
But, that drive is only 8GB
[root@ip-10-244-134-250 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 8.0G 1.3G 6.7G 16% /
tmpfs 3.7G 0 3.7G 0% /dev/shm
But, fdisk and /proc/partitions both show correct size
[root@ip-10-244-134-250 ~]# fdisk -l
Disk /dev/xvda1: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/xvda1 doesn't contain a valid partition table
[root@ip-10-244-134-250 ~]# cat /proc/partitions
major minor #blocks name
202 1 524288000 xvda1
Any help would be greatly appreciated, thanks.
If the root file system is ext3 or ext4, then run:
If the root file system is xfs (less common), then run:
You can omit "sudo" if you are logged in as root.
These commands should be run while the system is running and the file system is mounted.
It's standard for EBS volumes to not contain a partition table. The EBS volume is generally formatted as a file system in its entirety without partitions.
The answers here seem to be missing a few steps prior to re-sizing specially for people who are changing their EBS volume size. If you have used a snapshot to create the EBS or with certain AMIs you will need to extend the disk (xvda), extend the partition (xvda1), then extend the filesystem (/).
If I'm reading this correctly, your disk looks like this:
It needs to look like this:
After that, running
resize2fs
will grow into that new space withinxvda1
, usingfdisk
we can increase the block size by deleting and creating it again and making the partition bootable. all it requires is a reboot. In most cases it shouldn't effect your data if you use same start cylinder but Note that any mistake in recreating the partion will result in losing all data and/or the server will not reboot. I would recommend doing this as the first step on a newly created instance. Otherwise take a snapshot of your EC2 EBS Storage/etc.I have marked the steps with <<#>> in the block below, so the are not a part of the command. You need root permissions, so do a "sudo sh" if you are not root.
Resize the filesystem on the EBS volume. If you're running
ext3
(which is usually the default), you can just rune2resize /dev/xvda1
.I tried the answer from @Neo with an instance created from a custom Ubuntu AMI. The explanation was very helpful but I needed to keep the units as blocks and just skip step #4. It then worked perfectly.
Also just a point is that in step #5 you must copy the starting block / cylinder to use in step #10.
@Neo's answer is if you have a partitioned virtual disk device. You can find if you suffer from this problem with the following:
lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 30G 0 disk └─xvda1 202:1 0 5G 0 part /
The xvda and xvda1 are very different sizes. You can resize2fs and it won't make any difference, in my case xvda1 is 5G and that's all the filesystem will use.Thanks, @Neo