By: Emiley J in Cloud Tutorials on 2012-10-16
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
[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
- 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
- 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.
- 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]#
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Most Viewed Articles (in Cloud )
Latest Articles (in Cloud)
- Data Science
- React Native
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews