Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7992741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:39:21+00:00 2026-06-04T13:39:21+00:00

Amazon provides instance store for EC2 instances. If you use your own AMI, these

  • 0

Amazon provides instance store for EC2 instances. If you use your own AMI, these are not formatted or mounted automatically for you. You need to manually format and mount them.

The available devices are listed here and vary based on type of instance. For example an m1.small will have different available instance store devices than c1.xlarge.

I’m looking for a script which

  1. Detects what the instance type is. Perhaps by using
    curl -s http://169.254.169.254/latest/meta-data/instance-type
  2. Formats and mounts all devices which are available for that instance type but have not yet been formatted/mounted.

Possible? Done it? Have it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:39:25+00:00Added an answer on June 4, 2026 at 1:39 pm

    So, here is what I built for this.

    #!/bin/bash
    
    # This script formats and mounts all available Instance Store devices
    
    ##### Variables
    devices=( )
    
    ##### Functions
    
    function add_device
    {
        devices=( "${devices[@]}" $1 )
    }
    
    function check_device
    {
        if [ -e /dev/$1 ]; then
            add_device $1
        fi
    }
    
    function check_devices
    {
        check_device sda2
        check_device sda3
        check_device sdb
        check_device sdc
        check_device sdd
        check_device sde
    }
    
    function print_devices
    {
        for device in "${devices[@]}"
        do
            echo Found device $device
        done
    }
    
    function do_mount
    {
        echo Mounting device $1 on $2
    fdisk $1 << EOF
    n
    p
    1
    
    
    
    w
    EOF
    # format!
    mkfs -t xfs -f $1
    
    mkdir $2
    mount $1 $2
    
    echo "$1   $2      xfs     defaults          0 0" >> /etc/fstab
    
    }
    
    function mount_devices
    {
        for (( i = 0 ; i < ${#devices[@]} ; i++ ))
        do
            mountTarget=/mnt
            if [ $i -gt 0 ]; then
                mountTarget=/mnt$(($i+1))
            fi
            do_mount /dev/${devices[$i]} $mountTarget
        done
    }
    
    
    ##### Main
    
    check_devices
    print_devices
    mount_devices
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an Amazon EC2 Instance that provides Windows Server 2008 with SQL
Amazon offers two instance types on EC2: 1) On-Demand and 2) Reserved. After reading
Which is the recommended Amazon EC2 instance size for creating a large (100k+ users)
I am developing an application that store some data in a Amazon SimpleDB instance.
I want to use Amazon web services to store files, and I am new
Our company provides some management on behalf of smaller businesses using Amazon EC2. Almost
I have tried the JSON SerDe that Amazon provides for EMR instance and works
The zend framework provides a php wrapper for the amazon S3 api that simplifies
our Amazon EBS backed instance has slowed down considerably (maybe shifted physical host?). I've
Trying to get Amazon's EC2 command line tools to work. This is what my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.