EC2 Root partition does not get resized to the available space
Issue
-
When creating an instance in Amazon Web Services from an AMI, the user has the ability to select a volume size for the root device. The expected behavior is that the root filesystem of the instance will match the size of the EBS volume created on launch.
-
Instances created using HVM AMIs for RHEL from Cloud Access do not resize the filesystem to match the device.
-
If we select a HVM AMI for RHEL 6.5 (RHEL-6.5_HVM_GA-x86_64-4-HVM-Access2 ami-3225be02) and launch a new instance with a 10GB EBS volume, the resulting instance will have a 6GB root filesystem and a 10GB device. This is not the expected or desired outcome. 6GB is the default size of the device for a new instance based on the registered block device in the AMI, /dev/sda1=snap-80726aba:6:true:standard.
[root@host ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/xvda1 ext4 5.7G 1.9G 3.7G 35% /
none tmpfs 1.9G 0 1.9G 0% /dev/shm
[root@ip-10-233-146-5 ~]# parted -l
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 983kB 6145MB 6144MB primary ext4
- If we select a PVM AMI for RHEL 6.5 (RHEL-6.5_GA-x86_64-4-Access2 ami-28f89018) and launch a new instance with a 10GB EBS volume, the resulting instance will have a 10GB root filesystem and device as expected.
[root@host ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/xvda1 ext4 9.9G 2.0G 7.9G 20% /
none tmpfs 1.9G 0 1.9G 0% /dev/shm
[root@ip-10-236-141-4 ~]# parted -l
Model: Unknown (unknown)
Disk /dev/xvda1: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 10.7GB 10.7GB ext4
- An Amazon Linux HVM AMI (amzn-ami-hvm-2014.03.1.x86_64-ebsami-383a5008) works as expected with the root filesystem matching the device size.
[root@host ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/xvda1 ext4 9.8G 1.1G 8.6G 11% /
devtmpfs devtmpfs 1.9G 56K 1.9G 1% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
[root@ip-10-233-151-2 ~]# parted -l
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
128 1049kB 2097kB 1049kB BIOS Boot Partition bios_grub
1 2097kB 10.7GB 10.7GB ext4 Linux
- We also tested with the public HVM AMIs for RHEL 6.5 and 7 and saw the same behaviors. This points to an AMI creation issue.
Environment
- Red Hat Enterprise Linux
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.