Docs‎ > ‎Espresso Appliance‎ > ‎

Increasing Disk Space in AWS EC2 Cloud

This page explains how to increase the disk space of the Espresso Logic appliance hosted as an AWS EC2 instance.

I want to increase the disk space on the Espresso Logic Appliance

Resizing the root partition on an Amazon EC2 instance starts by stopping your instance.

First, go to volumes on the left-hand EC2 navigation control panel. Once you’re there, look under attachment information and identify the volume that is attached to the instance on which you want to change the root partition.

Right-click on the volume you want to resize and select Create Snapshot.

Fill out the details of the snapshot you’re creating. This will help you identify it in your snapshot inventory.

Select Snapshots on the left hand side of the EC2 control panel. From here you can see your snapshot being created. Make sure you remember what availability zone your running instance/server is in; what you do next will require that information

Right hand click on the snapshot you just created and select Create Volume from Snapshot.

Enter the new size you would like the partition to be, select the same availability zone of your running instance then click on yes, create.

Head back over to volumes in the EC2 control panel. Once there, select the root volume we just created an image of, right click on it, and select detach volume. We are doing this because now that we created a new 20gig volume, we are going to attach that new volume in place of the old volume.

Now right click on the new volume we created.

Attach the volume

It’s important to make sure the volume is attached as /dev/sda1, so change the volume name from /dev.sdf. If you do not do this, your instance will NOT be able to turn back on.

As soon as the volume is attached, go back to your instances and turn your instance back on.

Login to your instance and run df -m as sudo or root. You’ll notice that your partition size is still the same even though we created a larger volume. Now we need to resize the partition inside of Linux.

Make note of the partition name; in our case it’s /dev/xvda1.

Next, check the partition table of the virtual disk in the guest

fdisk -l /dev/xvda 
Disk /dev/xva: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000315bc

Device      Boot      Start         End      Blocks    Id  System
/dev/xva1  *           1               64        512000   83  Linux
/dev/xva2              64              1045   7875584  8e  Linux

Now, shutdown the guest before you resize the virtual disk

shutdown -h now
Use VMware player/ Workstation or Fusion and add space to the dormant Espresso Logic Appliance Virtual Machine (in this example we expanded form 8GB to 20GB)
Restart the virtual machine
re-login as root

Once the CentOS Guest is back up, add a new partition using the free space available on your virtual disk. NOTE: Use partition id 8e for Linux LVM.

fdisk /dev/xvda
  n  {new partition}
  p  {primary partition}
  3  {partition number}
    First cylinder (1045-2610, default 1045): 
        Using default value 1045
        Last cylinder, +cylinders or +size{K,M,G} (1045-2610, default 2610): 
        Using default value 2610
t {change partition id} 3 {partition number] 8e {Hex code: Linux LVM partition} w {save changes}

You may need to reboot, if the update doesn’t’ work.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. reboot

Recheck the partition table after reboot

fdisk -l /dev/xvda

Disk /dev/xva: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000315bc

 Device Boot      Start         End      Blocks     Id  System
/dev/xva1   *     1             64       104391     83  Linux
/dev/xva2         14            8354     66999082+  8e  Linux LVM
/dev/xva3         8355          10443    16779892+  8e  Linux LVM

Now, create a new physical volume with the new partition

pvcreate /dev/xvda3

Use vgextend to list and identify the volume groups that you have

vgextend vg_centos65 /dev/xvda3

Now, extend the logical volume again, using lgdisplay to list and identify the logical volumes that you have.

lvextend /dev/vg_centos65/lv_root /dev/xvda3

Finally, resize the file system in the logical volume

resize2fs /dev/vg_centos65/lv_root

Verify the file system size

df -h
Filesystem                        Size    Used    Avail  Use%    Mounted on
/dev/mapper/vg_centos65-lv_root    19G    4.3G     14G    25%    /
tmpfs                             931M        0   931M     0%    /dev/shm
/dev/xva1                         485M      67M   393M    15%    /boot