Friday, April 2, 2010

How to add additional Disk to VMWare Linux Virtual Machine

Open the VMWare
Select the Linux virtual Machine , that you want to add more space.

Click on edit Virtual machine settings. This will allow to configure virtual machine devices. Below I have attached the screenshot of virtual machine setting dialog box.



Now we will seee how to add new hardware using this setting dialog
box







Click on Add button, it will open a "Add Hardware Wizard" dialog box.











Select Hard Disk from the list of hardware.












Select create new virtual disk











Select disk type as SCSI (recommended)
Set the diskspace. In this example I have used 50GB


Enter the name and location of the disk file. After that click finish button.

Now Start the virtual Machine.  You can view the new device under /dev folder in linux virtual machine. Now we need to partition this new device using fdisk.

Small Introduction for fdisk
fdik is a menu driven program for creation and manipulation of partition tables. It understands DOS type partition tables and BSD or SUN type disklabels.

The device is usually one of the following:


/dev/hd[a-h]   for IDE disks
/dev/sd[a-p]   for SCSI disks
/dev/ed[a-d]   for ESDI disks
/dev/xd[ab]    for XT disks

Partition is a device name followed by a number (e.g sdb1)

How to use fdisk for our purpose:
Enter commnd fdik /dev/sdb








Enter n for new partition ,
Enter p for primary partition
Enter w for altering partition

Next step is to format the above partition:
I have used ext3 filesystem for this partition mkfs -t ext3 /dev/sdb1

Create a mount point for new partition

In this I want to mount this partion to u01 folder

create folder using mkdir /u01. Now mount the new partition to new folder using command mount -t ext3 /dev/sdb1 /u01.

To check the partition is properly mounted using df -k . This command will display mounted points and avaiable disk space.

Open the /etc/fstab file and add /dev/sdb1 /u01 ext3 defaults 1 1.
The /etc/fstab used to map devices to location. Typically when you plug in an external device, after plugin external device will appear under /dev folder.


But we can't access these devices through /dev folder. You need to map these devices to a normal folder, so it can be used. Without fstab file only root user can able to manage theses devices. Creating a fstab entry will allow permission to normal users.






No comments: