by December 30, 2013 0 comments

In my last few years with AWS EC2 cloud I have admired many things, but there has been few things which I have hated. Though the reason of hate I am talking about here, is nothing to do with AWS, it’s more to do with Linux and how Linux disks are created on AWS.  One of the greatest features of AWS is that, you can very easily add more storage space to an existing partition.

This can be done by:
1. First by creating a snapshot of this disk
2. Then by creating a volume back from the snapshot, but this time with a higher disk space.
3. And finally, you have to replace the existing volume connecting to the machine with the new volume with higher disk space.

All you have to make sure is that, the disk should be connected with the same device name. So for instance, if the old volume was connected to the instance as /dev/sda1, then the new disk also should be connected to the machine as /dev/sda1.

Now, if it’s a Widow’s machine, all you have to do is to go to disk management and expand the existing disk. But on a Linux machine, if you want to expand your existing partition which already has data. Then it’s mostly a nightmare. And that’s because. The EBS backed AMIs are on LVM and the only way of expanding the existing disks is you use “parted”. Now parted is pretty complex and if you are not an expert. It’s not advisable to play with it. So, the other possible option is the graphical version of parted. GParted. Now the problem is how do you get your Amazon EC2’s graphics on your client machine? The traditional approach will be to use VNC or alike. And will certainly make your systems heavy. Adding to it is the pain of configuration time. And to top it all the security threat as you will be opening the VNC port on your server for this.

Here comes the solution. As I have faced this issue myself many times, I have finally concluded that using GParted on over SSH with an X11 server installed on your client machine is the safest.

But, configuration could be painful for many. So what I have done is, I have created an AMI which already has X11 forward configured and GParted and related components installed. So, all you have to do is to install X11 on your client machine and connect to the appliance. Below is a quick how-to on using the AMI for expanding your Linux disks. We have chosen Windows as a client machine and used the free X11 server for Windows called XMing. And we have used XShell (free for home and non-commercial use). You can download both of them through the below links. Once down, just run the setup and finish the installation. It’s pretty easy/
XMing: – sf.net/projects/xming/
XShell: – http://www.netsarang.com/download/down_xsh.html
And for Linux users. You don’t need anything, other than X11 installed on the client machine. Now here is what you need to do.

Step 1: Login to your AWS account and create a Snapshot of the disk you want to expand[image_library_tag 723/90723, style=”display: block; margin-left: auto; margin-right: auto;” alt=”image05-1″ ,default]
Step 2: Now create a new volume using the snapshot with the desired disk space. Here is how you initiate the Snapshot to Volume Creation wizard.[image_library_tag 718/90718, style=”display: block; margin-left: auto; margin-right: auto;” alt=”image06-2″ ,default]
The wizard looks like this, and you can feed in the desired size in the “Size:” field.
Just make sure the Availability Zone of this disk is same as the availability zone in which the EC2 instance resides. Else your instance will not be able to access the disk created.
Step 3: Start a micro instance with the AMI number “ami-53035d3a”. We have only made this AMI available on N. Virginia zone, just to keep our costs on check. If any of you want to use it in some other zone. We would love to make it available there. Just drop a post at http://forums.pcquest.com/forum/ or shoot a mail to x-anindyar@cybermedia.co.in . Also make sure the Instance is started in the same availability zone where the volume is created. So that this instance can see and access the volume.[image_library_tag 721/90721, style=”display: block; margin-left: auto; margin-right: auto;” alt=”image00-3″ ,default]
Step 4: Once the instance is created, attach the Volume which you have just expanded to this instance.[image_library_tag 720/90720, alt=”image04-4″ ,default]
Step 5: Now run the XLaunch wizard of XMing utility. And in the first screen select Multi Window radio button. And put “0” in display number. Now finish the wizard with rest of the default settings. Once done. You will see the XMing icon in your Notification Area.[image_library_tag 722/90722, style=”display: block; margin-left: auto; margin-right: auto;” alt=”image01-5″ ,default]
Step 6: Now start Xshell and create a session to connect to the EC2 instance which you have just created with the PCQLinux GParted AMI. Here use username as “root” and password as “pcq@123″ to connect. In the Authentication[image_library_tag 719/90719, style=”display: block; margin-left: auto; margin-right: auto;” alt=”image03-6″ ,default]
Step 7: Now you have to enable X11 forwarding in this session. To do so, click on the SSH Tunneling tab in the left side of the window. And here under “X11 Forwarding”, check the option which says “Forward X11 connections to:” and just below that, click on the second radio button which says “X DISPLAY”. And in the field next to it put localhost:0[image_library_tag 717/90717, style=”display: block; margin-left: auto; margin-right: auto;” alt=”image02-7″ ,default]
Step 8: Now connect to the EC2 instance with this session which you have just created. And run the command “gparted” and you will see the GParted screen start on your Windows desktop.[image_library_tag 724/90724, style=”display: block; margin-left: auto; margin-right: auto;” alt=”image07-8″ ,default]

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.

Your data will be safe!Your e-mail address will not be published. Also other data will not be shared with third person.