Search code examples
amazon-web-servicesdevopspartitioningvolume

How do I increase ebs partitions volume size on aws ec2?


While I was deploying an application on some partition (on aws-ec2 instance) I got fatal error I'm out of space on this block No space left on device.

How do I increase ebs partitions volume size on aws ec2?


Solution

  • Solution:

    1. Go to your amazon machine and run lsblk (ls block) - useful Linux command which lists information about all or the specified block devices (disks and partitions). It queries the /sys virtual file system to obtain the information that it displays. The command displays details about all block devices excluding except RAM disks in a tree-like format by default.)

      NAME           MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
      loop0            7:0    0 93.9M  1 loop  /snap/core/123
      loop2            7:2    0   18M  1 loop  /snap/amazon-ssm-agent/456
      loop3            7:3    0   18M  1 loop  /snap/amazon-ssm-agent/789
      loop4            7:4    0 93.8M  1 loop  /snap/core/777
      xvda           202:0    0   20G  0 disk
      └─xvda1        202:1    0   20G  0 part  /
      xvdb           202:16   0   20G  0 disk  /home/boot
      xvdc           202:32   0   20G  0 disk
      ├─xvdc1        202:33   0   10G  0 part
      |  └─cryptswap1 253:0    0   10G  0 crypt
      └─xvdc2        202:34   0   10G  0 part
        └─crypttmp   253:1    0   10G  0 crypt /tmp
      xvdd           202:48   0   50G  0 disk
      └─enc_xvdd     253:2    0   50G  0 crypt /home
      xvde           202:64   0  8.9T  0 disk
      └─enc_xvde     253:3    0  8.9T  0 crypt /var/data
      
    2. Locate your disk volume name of the specific partition.

    3. Go to your amazon aws account -> ec2 -> instances -> Description Panel -> Block Devices -> Click on the right block -> Click on the volume id -> Right CLick on the block id -> Modify Volume -> Select The correct size

    enter image description here

    4.ssh your machine and perform the following commands (on the correct volume - in my example I chose increasing /home which is under enc_xvdd):

    sudo cryptsetup resize enc_xvdd -v
    sudo resize2fs /dev/mapper/enc_xvdd