How to Create/Add a New Virtual Disk for an Existing Linux Virtual Machine

This article helps you to create and add a new virtual disk to an existing Linux virtual machine on VMware. Here are some steps for adding a new SCSI based virtual disk on a CentOS Linux virtual machine. We are assuming that you are already familiar with Linux system administration skills and having knowledge of vCenter Server or vSphere Client. For a full description of the utilities mentioned in this article, please refer to the manuals.

Solution

To add a new virtual disk for an existing Linux virtual machine, Log in as root on your Linux virtual machine. Run this below command and make note of the sdx entries, means list of existing hard disks.

# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2

Log into the vCenter Server using the vSphere Client.

In the vSphere Client inventory, right-click the virtual machine and select Edit Settings.

Click the Hardware tab and click Add.

Select Hard Disk and click Next.

Complete the wizard. After adding the Hard disk to VMware/vSphere/vCenter it looks like this.

Reboot the Linux virtual machine.

# init 6

Log into the Virtual machine using the root credentials and run this command.

# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sdb

We will find new entry.

Create an ext3 file system on the new disk using the new ‘sdb’ disk from the above list of disks

You may see an alert that, you are performing this operation on an entire device, not a partition. That is correct, as you created a single virtual disk of the intended size. This is assuming you have specified the correct device.

Caution: Ensure that you have the selected the right device, there is no undo.

Run the fdisk command to verify the existence of the disk you created.

Using a text editor to edit fstab and add this line to add the disk to /etc/fstab so that it is available across reboots

/dev/sdb /newdisk ext3 defaults 1 3

After this configuration you are able to add new Virtual hard disk drives to existing Linux machines on VMware/vSphere/vCenter. This will help in the provision of a hard disk for backups or stored data to the existing Centos Linux machines.