Saturday, 29 September 2012

VMware vCloud Service- Adding new hard disks

VMware vCloud Service - Part3

Adding new HDDs to existing VMs

In this series of Posts, I am going to provide How-To guides for getting up and running with VMware vCloud Service Evaluation.
In Part 1 of this series we saw how to create an account for VMware vCloud Service Evaluation using a Promo Code.
In Part 2 of this series we created our very first CentOS vApp !!

In this blog, we are going to add an additional Hard Disk to our existing VM

Although all VMware vCloud Service Evaluation VMs come with a 50GB HDD, you may come up with a requirement to add a couple of your own.

vCloud Service provides you with an option of adding new HDD to your existing VMs. The size of these HDDs can vary from minimum of 10GB to 1500GB.

NOTE: Remember, you will be charged according to the size of your HDD. Each new HDD you add has an associative cost with it !! 
Login to your vCloud ( using the Administrative Username and Password provided to you by vCloud Evaluation

Once you logged in, Select the "My Cloud Tab". This tab will display the VMs and vApps that you would have created (as shown in our earlier tutorial)

I have here a TEST SERVER (CentOS 6.2) running.

In order to change the configuration of your VM, you need to first Power it OFF. Select the Power OFF option as shown below.

You will be prompted with this pop-up screen. 

NOTE: Avoid doing a "Immediate Power Off".. It may corrupt your OS. Always do a peaceful shutdown of your VMs :-)

NOTE: Remember that even if you shut down/ suspend a VM, you are still being charged for it. So if you don't plan to use it for a long time, I strongly suggest you destroy your VM.

You VM will turn off in couple of seconds.

Once it switches Off, select the "Change Configuration" Option as shown below:

In the Change Configuration wizard, scroll down to the "Hard Drives" section. You can add new Hard Drives by simply selecting "Add a New Hard Drive" Option.

NOTE: vCloud Service supports new Hard Drive sizes ranging from 10 GB min to 1500 GB max. Provide you own HDD size. When done, simply click "Add"

I have added two Hard Drives, one 10GB and an another 15 GB Drive. Click Submit once done.

NOTE: The cost of your VM will change depending on the number of Hard Drives and their sizes.

You are now ready to Power ON your VM

Once you VM will power ON, you can see the two newly added Hard Drives. Note the External IP of the VM down. We will need it to access the VM and add the HDDs.

NOTE: A sad thing here is VMware does not automate the formatting and mounting of the new Hard Drives. And its not done for few particular reasons. One I can think of is that you may want to mount your HDD to a mount point of your choice, or possibly; create a different file system on it for some special purpose.

I am using WinSCP to login to my VM. You can use any other tool so long as it serves the purpose.. 

Provide the External IP Address, Username (You are provided Root access by default) and Admin Password of your VM.

A security warning is displayed. Click Yes to proceed

You will be shown WinSCP's Interface as shown below. You can use this interface to basically drag drop items from your local Windows Machine to your Linux Machine.

To launch a Putty Session, select "Commands" >> "Open in Putty

Putty will also provide a Host Certificate. Click Yes to proceed

You can now login to your CentOS VM remotely. Use Root as the username and provide the Admin Password when asked for..

After we've logged in and accessed the terminal window as root (or another user with root/ sudo priveledges) we first want to run fdisk -l to display list of partitions.

In Linux the first SCSI drive is sda, the second sdb, the third sdc, etc. Since we added two hard drives, the devices will be shown as /dev/sdb and /dev/sdc

As shown above, the new hard drive has been assigned to the device file /dev/sdb and /dev/sdc. At this point the drives have no partitions shown (because we have yet to create any).

The next step is to create one or more Linux partitions on the new disk drive. This is achieved using the fdisk utility which takes as a command-line argument the device to be partitioned:

The basic fdisk commands you need are:

  • m - print help
  • p - print the partition table
  • n - create a new partition
  • d - delete a partition
  • q - quit without saving changes
  • w - write the new partition table and exit

In order to view the current partitions on the disk enter the p command:

In this example we only plan to create one partition which will be partition 1.

Next we need to specify where the partition will begin and end. Since this is the first partition we need it to start at cylinder 1 and since we want to use the entire disk we specify the last cylinder as the end.

NOTE: that if you wish to create multiple partitions you can specify the size of each partition by cylinders, bytes, kilobytes or megabytes.

Once you have specified the partition we need to write it to the disk using the w command
I stuck with default values throughout the Partition creation process. 
Create a New Partition (n)
Make that new Partition a Primary Partition (p)
Accept the default values for the first and last sectors  

Do the same for the second disk (/dev/sdc) as done before

You now have two Partition Tables ready. The next step is to create the File Systems on these two drives.

Once the partition table is ready, simply create the file system on that particular hard disk using mkfs.<filesystemtype> command as shown:

Do the same for the second Drive as well (/dev/sdc1)

In order to do this we need to create a mount point. A mount point is simply a directory or folder into which the file system will be mounted. For the purposes of this example we will create a /extra in root (/) directory to match our file system label (although it is not necessary that these values match): mkdir /extra

I have created two sub directories in /extra named primary and secondary

The file system may then be manually mounted using the mount command: 

# mount /dev/sdb1 /extra/primary

# mount /dev/sdc1 /extra/secondary

NOTE: If you have multiple new HDDs, then don't mount the second Hard Disk on the same mount point. Create a new one for each Hard Disk as I have done above.
You can view the different HDDs and their mount Points using the df -h command

In order to set up the system so that the new file system is automatically mounted at boot time an entry needs to be added to the /etc/fstab file.

The following example shows an fstab file configured to automount our /extra/primary and /extra/secondary partitions

IMP NOTE: Do not provide <spaces> between each text in the fstab file. Use the TAB key instead.

With the appropriate configuration line added to the fstab file, the file system will automatically mount on the next system restart.

Once you reboot your VM, run the command df -h to see whether the 10 and 15 GB HDDs were mounted successfully or not.

That's it for this tutorial.. Stay tuned for much more !!

No comments :

Post a Comment

Note: only a member of this blog may post a comment.