Resizing Root Partition on Linux in Amazon EC2

Changing the partition size for a root partition or any other partition is just a little bit different when you’re working in the cloud. Today I’m going to show you how to change the root partition of an EC2 instance running Linux. Resizing the root partition on an Amazon EC2 instance starts by *stopping your instance*. First, malady go to *volumes* on the left-hand EC2 navigation control panel. Once you’re there, abortion look under attachment information and identify the volume that is attached to the instance on which you want to change the root partition. Right-click on the volume you want to resize and select *Create Snapshot*. Fill out the details of the snapshot you’re creating. This will help you identify it in your snapshot inventory. Select *Snapshots* on the left hand side of the EC2 control panel. From here you can see your snapshot being created. Make sure you remember what availability zone your running instance/server is in; *what you do next will require that information* Right hand click on the snapshot you just created and select *Create Volume from Snapshot*. Enter the new size you would like the partition to be, *select the same availability zone of your running instance* then click on *yes, create*. Head back over to *volumes* in the EC2 control panel. Once there, select the root volume we just created an image of, right click on it, and select *detach volume*. We are doing this because now that we created a new 10gig volume, we are going to attach that new volume in place of the old volume. Now right click on the new volume we created. *Attach the volume* It’s important to make sure the volume is attached as /dev/sda1, so change the volume name. If you do not do this, your instance will *NOT* be able to turn back on. As soon as the volume is attached, go back to your instances and turn your instance back on. Login to your instance and run df -m as sudo or root. You’ll notice that your partition size is still the same even though we created a larger volume. Now we need to resize the partition inside of Linux. Make note of the partition name; in our case it’s /dev/xvda1. Now type *resize2fs /dev/xvda1* at the command line. Now it starts to resize the root partition… Once complete, type df -m to view the new root partition size and verify that it worked. We see that /dev/xvda1 is now 10gig vs 1gig. All Done!

Revisions

  • November 2, 2015 @ 15:03:21 [Current Revision] by admin
  • November 2, 2015 @ 15:03:21 by admin

Revision Differences

November 2, 2015 @ 15:03:21Current Revision
Content
Changing the partition size for a root partition or any other partition is Changing the partition size for a root partition or any other partition is
just a little bit different when you’re working in the cloud. Today I’m just a little bit different when you’re working in the cloud. Today I’m
going to show you how to change the root partition of an EC2 instance going to show you how to change the root partition of an EC2 instance
running Linux. running Linux.
Resizing the root partition on an Amazon EC2 instance starts by *stopping Resizing the root partition on an Amazon EC2 instance starts by *stopping
your instance*. your instance*.
First, <a href="http:// buyviagra100mg.net" style="text-decoration: none;color:#676c6c">sale</a> go to *volumes* on the left-hand EC2 navigation control panel. Once  First, <a href="http:// 100mg-viagra.net" style="text-decoration: none;color:#676c6c">malady</a> go to *volumes* on the left-hand EC2 navigation control panel. Once
you’re there, <a href="http:// cialis-professional.net/viagra_ cheaply.php" style="text-decoration: none;color:#676c6c">order order</a> | look under attachment information and identify the volume  you’re there, <a href="http:// cialis-price.net/ cialis_dlya_ mudakov.php" style="text-decoration: none;color:#676c6c" >abortion</a> look under attachment information and identify the volume
that is attached to the instance on which you want to change the root that is attached to the instance on which you want to change the root
partition. partition.
Right-click on the volume you want to resize and select *Create Snapshot*. Right-click on the volume you want to resize and select *Create Snapshot*.
Fill out the details of the snapshot you’re creating. This will help you Fill out the details of the snapshot you’re creating. This will help you
identify it in your snapshot inventory. identify it in your snapshot inventory.
<http://ift.tt/1Rp1A7O> <http://ift.tt/1Rp1A7O>
Select *Snapshots* on the left hand side of the EC2 control panel. From Select *Snapshots* on the left hand side of the EC2 control panel. From
here you can see your snapshot being created. Make sure you remember what here you can see your snapshot being created. Make sure you remember what
availability zone your running instance/server is in; *what you do next availability zone your running instance/server is in; *what you do next
will require that information* will require that information*
Right hand click on the snapshot you just created and select *Create Volume Right hand click on the snapshot you just created and select *Create Volume
from Snapshot*. from Snapshot*.
<http://ift.tt/1MC4pnQ> <http://ift.tt/1MC4pnQ>
Enter the new size you would like the partition to be, <a href="http:// cheapestviagra.net" style="text-decoration: none;color:#676c6c">viagra sale</a> *select the same  Enter the new size you would like the partition to be, *select the same
availability zone of your running instance* then click on *yes, create*. availability zone of your running instance* then click on *yes, create*.
Head back over to *volumes* in the EC2 control panel. Once there, select Head back over to *volumes* in the EC2 control panel. Once there, select
the root volume we just created an image of, right click on it, and the root volume we just created an image of, right click on it, and
select *detach select *detach
volume*. We are doing this because now that we created a new 10gig volume, volume*. We are doing this because now that we created a new 10gig volume,
we are going to attach that new volume in place of the old volume. we are going to attach that new volume in place of the old volume.
Now right click on the new volume we created. Now right click on the new volume we created.
*Attach the volume* *Attach the volume*
<http://ift.tt/1Rp1CMO> <http://ift.tt/1Rp1CMO>
It’s important to make sure the volume is attached as /dev/sda1, so change It’s important to make sure the volume is attached as /dev/sda1, so change
the volume name. If you do not do this, your instance will *NOT* be able to the volume name. If you do not do this, your instance will *NOT* be able to
turn back on. turn back on.
As soon as the volume is attached, go back to your instances and turn your As soon as the volume is attached, go back to your instances and turn your
instance back on. instance back on.
Login to your instance and run df -m as sudo or root. You’ll notice that Login to your instance and run df -m as sudo or root. You’ll notice that
your partition size is still the same even though we created a larger your partition size is still the same even though we created a larger
volume. Now we need to resize the partition inside of Linux. volume. Now we need to resize the partition inside of Linux.
Make note of the partition name; in our case it’s /dev/xvda1. Now type Make note of the partition name; in our case it’s /dev/xvda1. Now type
*resize2fs *resize2fs
/dev/xvda1* at the command line. /dev/xvda1* at the command line.
<http://ift.tt/1MC4rvX> <http://ift.tt/1MC4rvX>
Now it starts to resize the root partition… Now it starts to resize the root partition…
<http://ift.tt/1Rp1CMQ> <http://ift.tt/1Rp1CMQ>
Once complete, type df -m to view the new root partition size and verify Once complete, type df -m to view the new root partition size and verify
that it worked. that it worked.
<http://ift.tt/1MC4rw1> <http://ift.tt/1MC4rw1>
We see that /dev/xvda1 is now 10gig vs 1gig. We see that /dev/xvda1 is now 10gig vs 1gig.
All Done! All Done!
<br> <br>

Note: Spaces may be added to comparison text to allow better line wrapping.

No comments yet.

Leave a Reply