I have created new volume and attached it to my amazon EC2 instance, but file system does not indicate newly-expanded volume size. How can I fix it?
In order to apply the changes you need to extend the file system on your device so that your instance can use the new space. This procedure varies depending on the operating system running on the instance.
Extending a Linux File System
Use the df -h command to report the existing file system disk space usage. In this example, the /dev/xvda1 device has already been expanded to 70 GB, but the ext4 file system only sees the original 8 GB size, and the /dev/xvdf device has been expanded to 100 GB, but the XFS file system only sees the original 1 GB size.
[ec2-user ~]$ df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 7.9G 943M 6.9G 12% / tmpfs 1.9G 0 1.9G 0% /dev/shm /dev/xvdf 1014M 33M 982M 4% /mnt
Use the file system-specific command to resize the file system to the new size of the volume. For a Linux ext2, ext3, or ext4 file system, use the following command, substituting the device name that you want to extend.
[ec2-user ~]$ sudo resize2fs /dev/xvda1 resize2fs 1.42.3 (14-May-2012) Filesystem at /dev/xvda1 is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 5 Performing an on-line resize of /dev/xvda1 to 18350080 (4k) blocks. The filesystem on /dev/xvda1 is now 18350080 blocks long.
For an XFS file system, use the following command, substituting the mount point of the file system (XFS file systems must be mounted to resize them).
[ec2-user ~]$ sudo xfs_growfs -d /mnt meta-data=/dev/xvdf isize=256 agcount=4, agsize=65536 blks = sectsz=512 attr=2 data = bsize=4096 blocks=262144, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 log =internal bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 262144 to 26214400
If you receive an
xfsctl failed: Cannot
allocate memoryerror, you may need to update the Linux kernel on your instance. For more information, refer to your specific operating system documentation.
Extending a Windows File System
In Windows, you use the Disk Management utility to extend the disk size to the new size of the volume.
Run The Disk Management utility :
- Windows Server 2012: Open the advanced context menu (Windows Key+X), select Disk Management.
- Windows Server 2008: On the taskbar, click Start, click Run and then type diskmgmt.msc.
Right-click the expanded drive and select Extend Volume.
- In the Extend Volume Wizard,EC click Next, then set the Select the amount of space in MB field to the number of megabytes by which to extend the volume. Normally, you set this to the maximum available space. Complete the wizard.
For more information about expanding amazon EBS volumes, see Expanding the Storage Space of a Volume