Creating a new virtual disk for an existing Linux virtual machine 

To create a new virtual disk for an existing Linux virtual machine:
  1. Log in as root on your Linux virtual machine.
  2. Run this command and make note of the sdxentries

    ls /dev/sd*

  3. Log in to the vCenter Server using the vSphere Client.
  4. In the vSphere Client inventory, right-click the virtual machine and select Edit Settings.
  5. Click the Hardware tab and click Add.
  6. Select Hard Disk and click Next.
  7. Complete the wizard.
  8. Reboot the Linux virtual machine.
  9. Log in using the root credentials.
  10. Running the command ls /dev/sd* will now return a new entry.
  11. Create an ext3 file system on the new disk using the new sdx from step 10.

    mkfs -t ext3 /dev/sdx

    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 you have selected the right device, there is no undo.

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

    fdisk -l

  13. Run this command to create a mount point for the new disk:

    mkdir / New_Directory_Name

  14. Run this command to display the current /etc/fstab:

    cat /etc/fstab

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

    /dev/sdx /New_Directory_Name ext3 defaults 1 3

    Note: Use a Linux text editor of your choice.

  16. Restart the Linux virtual machine and the new disk is now available.

Leave a comment