Expanding the Storage Space of Amazon EC2

Created:

2016-11-16 12:52:20 UTC

Modified:

2017-08-18 16:12:08 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Expanding the Storage Space of Amazon EC2

Applicable to:

  • Plesk 11.x for Linux

Symptoms

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?

Resolution

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

  1. 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
  2. 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

Note

If you receive an xfsctl failed : Cannot allocate memory error, 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.

  1. Run The Disk Management utility :
  2. Windows Server 2012: Open the advanced context menu (Windows Key+X), select Disk Management.
  3. Windows Server 2008: On the taskbar, click Start , click Run and then type diskmgmt.msc .

  4. Right-click the expanded drive and select Extend Volume .

  5. 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

Have more questions? Submit a request
Please sign in to leave a comment.