Advertisment

PCQLinux GParted AWS Appliance

author-image
Mastufa
New Update

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.

Advertisment

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.

Advertisment

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

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.

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.

Step 4: Once the instance is created, attach the Volume which you have just expanded to this instance.

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.

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

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

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.

Advertisment