Upgrade micro instance to small instance in Amazon ec2

By: Emiley J Viewed: 153206 times  Printer Friendly Format    


Upgrading from a micro instance to a small instance or from a small instance to a medium instance is usually very straight forward. First you create an AMI Image of the current instance. Then once the image is created, right click on the image and 'launch instance'. Only this time you will choose the right instance type and then follow the default settings for the rest of the screens. Thats it you are done. If you have an elastic IP mapped to your old instance, just detach the IP and attach it to the new instance you created.

All this you can do in less than 5 minutes. But only one more thing you need to do to make the hard disk space. Because the image you used to create will have the old disk space, in this example below it was just 8GB. So the new 'Small' instance will have only 8GB in the mounted volumme. So to fix this you have to do the following steps.

  1. First check the current disk space
    
    [root@ip-xx ec2-user]# df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/xvda1             8256952   7510540    662528  92% /
    tmpfs                   850896         0    850896   0% /dev/shm
    
  2. You can also check if the volume really has 160 G harddisk space as a small instance should have.
    
    [root@ip-xxxxx ec2-user]# fdisk -l
    
    Disk /dev/xvda1: 161.1 GB, 161061273600 bytes
    255 heads, 63 sectors/track, 19581 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: 0x00000000
    
    Disk /dev/xvda1 doesn't contain a valid partition table
    
    Disk /dev/xvda3: 939 MB, 939524096 bytes
    255 heads, 63 sectors/track, 114 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: 0x00000000
    
    Disk /dev/xvda3 doesn't contain a valid partition table
    
  3. Here is the magic command to fix this sudo resize2fs /dev/sda1
    [root@ip-xxxxx ec2-user]# sudo resize2fs /dev/sda1
    resize2fs 1.41.12 (17-May-2010)
    Filesystem at /dev/sda1 is mounted on /; on-line resizing required
    old desc_blocks = 1, new_desc_blocks = 10
    Performing an on-line resize of /dev/sda1 to 39321600 (4k) blocks.
    The filesystem on /dev/sda1 is now 39321600 blocks long.
    
  4. Finally check if everything is ok.
    [root@ip-xxxxx ec2-user]# df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/xvda1           154818540   7524044 145724724   5% /
    tmpfs                   850896         0    850896   0% /dev/shm
    [root@ip-xxxxx ec2-user]#
    


Most Viewed Articles (in Cloud )

Latest Articles (in Cloud)

Comment on this tutorial