• English
    • Deutsch (German)
    • Français (French)
    • Italiano (Italian)
    • 日本語 (Japanese)
  • Support
  • Login
  • Search
  • Solutions
    • Overview
    • Financial ManagementAnalyze, optimize, & plan technology spend
    • Cloud & HybridOptimize cost & utilization of multi-cloud & on-premises
    • Apps & ServicesRationalize portfolio & invest for growth
    • Vendors & SuppliersGovern your technology vendor portfolio
    • Agile & ProjectsTrack & prioritize investments for value
    • Business ValueShape business demand & recover costs
    • Public Sector ITAlign resources to reduce risk & maximize mission objectives
  • Products
        • PRODUCTS
        • ITFM FoundationAutomate IT financial planning & analysis
        • CloudabilityAllocate & optimize cloud resources
        • Cloudability SaaSIdentify SaaS apps to optimize costs and manage risk
        • Cost TransparencyAggregate & normalize IT cost, performance & utilization
        • TargetprocessAdopt and scale agile across the enterprise
        • All Products >
          • Bill of IT
          • Hybrid Business Management
          • IT Benchmarking
          • IT Planning Foundation
          • Vendor Insights
          • Project Financial Planning
        • Platform
        • DatalinkIngest & structure data from over 350 source systems
        • Apptio TBM Unified ModelEmploy best practices for data sources, allocations & KPIs
        • InsightsSurface actionable insights & opportunities hidden in your data
        • Self-Service ReportingUnlock information and share reports across your organization
        • Comments & CollaborationDrive clarity with rich context without leaving the system
        • Action PlansSet, track, & monitor progress toward goals & objectives
  • Resources
        • Overview
        • Testimonials
        • Resource Center
        • Blog
        • Community
        • Support
        • Professional Services
        • Events & Webinars
  • Company
        • Overview
        • Careers
        • Leadership
        • Technology Business Management
        • Trust
        • Partners
        • News
        • Locations
  • Get Started
  • Search
  • Support
  • Login
  • English (English)
    • Deutsch (German)
    • Français (French)
    • Italiano (Italian)
    • 日本語 (Japanese)
Start a Free Trial
Apptio Blog

How to Get Around the 8GB Limit on Root Volumes in AWS?

  • The Team at Apptio
  • October 30, 2017

When an AWS Elastic Cloud Compute (ECC) instance is first launched its root volume is sized by the Amazon Machine Images (AMI’s) backing snapshot. An Amazon Linux AMI creates an 8GB root volume. At launch, the root volume size can only be increased, not decreased. Some AMIs have even larger backing snapshots—creating waste. And waste comes with a cost. EBS volumes are paid GB-month regardless if the space is used.

There’s no reason to over-provision disk space in a cloud environment. Follow these steps to increase EBS volume size online.

  1. Go to AWS EC2 console, right click the EBS volume and select Modify Volume, increase the Size, and click Modify.
  2. Log on to the EC2 instance, use the growpart command to grow the partition to fill the available space.
growpart /dev/xvda 1

3. Use the ‘resize2fs command to resize the file system to fill the available partition space.

resize2fs /dev/xvda1

Unfortunately, it is still very difficult to decrease a root EBS volume size, and it can only be done offline. Here’s how to shrink an Amazon Linux EC2 root volume size from 8GB to 4GB:

  1. Stop the target EC2 instance.
  2. Snapshot the root EBS volume.
  3. Create an EBS volume from the snapshot. This will be the source EBS volume.
  4. Launch a new EC2 worker instance in the same region as the target instance.
  5. Attach the source EBS volume to the worker instance as xvdf.
  6. Create a new target EBS volume of smaller size 4GB. The size needs to be at least slightly larger than the actual filesystem used size.
  7. Attach the new target EBS volume to the worker instance as xvdg.
  8. Check file system on the source EBS volume. This is required to do the resize2fs.
e2fsck -p -f /dev/xvdf1

9. Shrink the file system to the minimal size.

resize2fs -M /dev/xvdf1

10. Get the newly shrunk file system’s total number of blocks.

NEW_FS_BLOCK_COUNT=`tune2fs -l /dev/xvdf1 | grep "Block count:" | awk '{print $3}'`
NEW_FS_BLOCK_SIZE=`tune2fs -l /dev/xvdf1| grep "Block size:" | awk '{print $3}'`
NEW_FS_SECTOR_COUNT=$((NEW_FS_BLOCK_COUNT*NEW_FS_BLOCK_SIZE/512))

11. Copy the entire newly shrunk file system disk blocks from source to the new target EBS volume.

DD_BS_1M=$((1<<20))
DD_COUNT=$((NEW_FS_SECTOR_COUNT*512/DD_BS_1M+1))
dd if=/dev/xvdf of=/dev/xvdg bs=1M count=${DD_COUNT}

12. Re-partition new target EBS volume to cover all usable space.

a. Delete partition 1.

sgdisk -d 1 /dev/xvdg

b. Get the last usable disk sector.

NEW_DISK_LAST_USABLE_SECTOR=`sgdisk -p /dev/xvdg | grep " last usable sector is " | awk '{print $10}'`

c. Recreate partition 1 to cover all usable space.

sgdisk -n 1:4096:${NEW_DISK_LAST_USABLE_SECTOR} /dev/xvdg

13. Grow file system on the new target EBS volume to fill the new partition space.

resize2fs /dev/xvdg1

14. Stop the worker instance.

15. Detach the new target EBS volume xvdg from the worker instance.

16. Detach the source EBS volume xvdf from the worker instance.

17. Attach the new target EBS volume to the target EC2 instance as xvda.

18. Start the target EC2 instance.

Even though we can reduce the root EBS volume size to a better fit size to save costs the process is complex and error-prone. Apptio helps users cut cost by reducing EBS root volume size with a click of a mouse from our SaaS web user interface.

Editor's note: This post was originally published on the now retired FittedCloud blog (January 2018).

Download 4 steps to successfully monitor and optimize hybrid IT

A hybrid IT approach offers the best of both on-premises and public cloud by keeping costs and risk low while increasing efficiency and speed. But monitoring and optimizing hybrid environments is complicated.

 

Apptio® Cloudability provides cost and resource optimization capabilities across all leading public cloud providers (AWS, Azure and Google Cloud) so IT leaders can increase the efficiency of public cloud spending and slash waste from over-purchase and underuse.

Try Apptio Cloudability for free

Article Contents

Categories

  • Cloud

Tags

  • AWS
Start a Free Trial

See These Related Items:

02/23/2018
  • Blog: Cloud

A Simple script to implement AWS EC2 TTL (Time to Live)

The Team at Apptio
Read the Article
11/29/2018
  • Blog: TBM

TBM: To Disrupt, or Be Disrupted?

Manik Patil
Read the Article
11/08/2018
  • Blog: Cloud

Making the Most of Your Cloud Infrastructure

Scott Koegler
Read the Article

See Cloudability in Action

Apptio Cloudability optimizes cloud resources and translates bills and tags into insights to provide real-time clarity and accountability for consumption.

Start a Free Trial
Apptio
Twitter
Linkedin-in
Envelope
  • Solutions
    • Overview
    • Financial Management
    • Cloud & Hybrid
    • Apps & Services
    • Vendors & Suppliers
    • Agile & Projects
    • Business Value
    • Public Sector IT
  • Products
    • PRODUCTS
    • ITFM Foundation
    • Cloudability
    • Cloudability SaaS
    • Cost Transparency
    • Targetprocess
    • All Products >
      • Bill of IT
      • Hybrid Business Management
      • IT Benchmarking
      • IT Planning Foundation
      • Vendor Insights
      • Project Financial Planning
    • Platform
    • Datalink
    • Apptio TBM Unified Model
    • Insights
    • Self-Service Reporting
    • Comments & Collaboration
    • Action Plans
  • Resources
    • Overview
    • Testimonials
    • Resource Center
    • Blog
    • Community
    • Support
    • Professional Services
    • Events & Webinars
  • Company
    • Overview
    • Careers
    • Leadership
    • Technology Business Management
    • Trust
    • Partners
    • News
    • Locations
  • Get Started
  • Search
  • Support
  • Login
  • English (English)
    • Deutsch (German)
    • Français (French)
    • Italiano (Italian)
    • 日本語 (Japanese)
Founder and Technical Advisor to the TBM Council

© 2007-2021 Apptio, Inc. All rights reserved. |  Privacy Policy | Modern Slavery Act Statement