Creating a new virtual disk for an existing Linux virtual machine

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 one partition on new disk, example to sdx:      
Command (m for help): p                                                                                                            
     Command (m for help): n                                                                                                            
     Command action                                                                                                                                        
        e  extended                                                                                                                                                 
        p primary partition (1-4)                                                                                                                               
     Partition number (1-4): 1    
     First cylinder (1-22400, default 1): <RETURN>
     Using default value 1
     Last cylinder or +size or +sizeM or +sizeK (1-22800, default 22800): 22400

     Command (m for help): w                                                                                                                      
   The partition table has been altered ! 

Create an ext3 file system on the new disk partition created

mkfs -t ext3 /dev/sdx1

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

Run the fdisk command to verify the existence of the new disk partition you created:

fdisk -l

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

mkdir /New_Directory_Name

Run this command to display the current content of /etc/fstab:

cat /etc/fstab

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

/dev/sdx1 /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 partition is now available.

If we want th machine to mou nt witout restrat:

mount /dev/sdx1 /New_Directory
mount -a

check mount

df -h