Upgrade micro instance to small instance in Amazon ec2
By: Emiley J
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.
- First check the current disk space
[[email protected] ec2-user]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda1 8256952 7510540 662528 92% / tmpfs 850896 0 850896 0% /dev/shm
- You can also check if the volume really has 160 G harddisk space as a small instance should have.
[[email protected] 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
- Here is the magic command to fix this sudo resize2fs /dev/sda1
[[email protected] 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.
- Finally check if everything is ok.
[[email protected] ec2-user]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda1 154818540 7524044 145724724 5% / tmpfs 850896 0 850896 0% /dev/shm [[email protected] ec2-user]#
Archived Comments
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview