Skip to content

Instantly share code, notes, and snippets.

@mrgonext
Created September 7, 2018 01:30
Show Gist options
  • Select an option

  • Save mrgonext/73f463cf455787cf1533f7c22e337e2c to your computer and use it in GitHub Desktop.

Select an option

Save mrgonext/73f463cf455787cf1533f7c22e337e2c to your computer and use it in GitHub Desktop.
Creating a new virtual disk for an existing Linux virtual machine
Note: The preceding link was correct as of May 19, 2015. If you find the link is broken, please provide feedback and a VMware employee will update the link.
To create a new virtual disk for an existing Linux virtual machine:
Log in as root on your Linux virtual machine.
Run this command and make note of the sdx entries
ls /dev/sd*
Log in to 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.
Reboot the Linux virtual machine.
Log in using the root credentials.
Running the command ls /dev/sd* will now return a new entry.
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.
Run the fdisk command to verify the existence of the disk you created:
fdisk -l
Run this command to create a mount point for the new disk:
mkdir / New_Directory_Name
Run this command to display the current /etc/fstab:
cat /etc/fstab
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.
Restart the Linux virtual machine and the new disk is now available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment