How do I extend my Linux file system after increasing my EBS volume on my EC2 instance?
"I increased the size of my Amazon Elastic Block Store (Amazon EBS) volume, but my file systems aren't using the full volume. How do I fix that?"
"I increased the size of my Amazon Elastic Block Store (Amazon EBS) volume, but my file systems aren't using the full volume. How do I fix that?ResolutionWhen a volume is expanded to a larger size, the file system must also be resized to take advantage of the larger volume size. You can resize a file system as soon as it's in the optimizing state.The following procedure extends an 8 GB ext4 file system to get full use of a 16 GB volume. The file system is on an Amazon Elastic Compute Cloud (Amazon EC2) instance running Ubuntu.1.    Create a snapshot of your volume before changing your volume or file system. For more information, see Create Amazon EBS Snapshots.2.    Use the df -h command to show the size and the percentage used by the file system.ubuntu@ip-172-31-32-114:~$ df -hFilesystem      Size  Used Avail Use% Mounted on/dev/xvda1      7.7G  7.7G     0 100% //dev/xvdf       7.9G  7.1G  370M  96% /home/ubuntu/testIn this example, the /dev/xvdf/ file system size is 7.9G and is 96% full.3.    Use the lsblk command to show the size of the xvdf volume.ubuntu@ip-172-31-32-114:~$ lsblkNAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTxvda    202:0    0    8G  0 disk└─xvda1 202:1    0    8G  0 part /xvdf    202:80   0   16G  0 disk /home/ubuntu/testIn this example, the size of the xvdf volume is 16G.4.    Connect to your instance using SSH. For more information, see Connect to your Linux instance.5.    If the volume has a partition containing a file system, that partition must be resized before the file system is expanded.6.    Use the resize2fs command to automatically extend the size of the /dev/xvdf/ file system to the full space on the volume.ubuntu@ip-172-31-32-114:~$ sudo resize2fs /dev/xvdfNote: In this example, the volume is using an ext4 file system. Depending on your file system, you might need to use a different utility. For more information, see Extend a Linux file system after resizing a volume.7.    Rerun the df –h command.ubuntu@ip-172-31-32-114:~$ df -hFilesystem      Size  Used Avail Use% Mounted on/dev/xvda1      7.7G  7.7G     0 100% //dev/xvdf        16G  7.1G  8.0G  48% /home/ubuntu/testThe /dev/xvdf/ file system is now 16G in size and only 48% full.Related informationView information about an Amazon EBS volumeMake an Amazon EBS volume available for use on LinuxExtend a Windows file system after resizing a volumeFollow"