How to add storage to VMWare vSphere without wiping the data

10,858

When I found this page I was trying to figure out how to add a local hard drive that had existing data to a new ESXi guest VM. You can add a disk to a datastore without formatting it by using RDM (Raw Device Mapping).

Vmware has a article about it here. You will want to read that page to learn more about the drawbacks and additional details.

Summary

Run the following command from terminal (via SSH) to find the desired device partition name:

# ls -l /vmfs/devices/disks

Then you will make it available by creating a RDM pointer file using the following command format:

vmkfstools -z /vmfs/devices/disks/diskname /vmfs/volumes/<ExistingDatastoreName>/<ExistingVMFolder>/<ChosenNameForThisRDM.vmdk

After that go to the vShpear Client or Embedded Host Client and attach the RDM to the guest VM:

  1. Right click the virtual machine you want to add an RDM disk to.
  2. Click Edit Settings.
  3. Click Add.
  4. Select Hard Disk.
  5. Select Use an existing virtual disk.
  6. Browse to the directory you saved the RDM pointer to in step 5 and select the RDM pointer file and click Next.
  7. Select the virtual SCSI controller you want to attach the disk to and click Next.
  8. Click Finish.

Now you can start the guest VM and mount the drive from inside the guest OS.

Share:
10,858

Related videos on Youtube

JeremyCanfield
Author by

JeremyCanfield

Certified Unix/Linux geek, with an affinity for CentOS.

Updated on September 18, 2022

Comments

  • JeremyCanfield
    JeremyCanfield over 1 year

    I have a question on how to add a storage drive in VMWare vSphere. Let's say I have installed ESXi, and I have 3 storage drive, and all 3 are showing at the Configuration tab in vSphere. Storage drive 1 has been formatted by VMWare and is running ESXi. Storage drive 2 has been formatted by VMWare and is accessible by the virtual machine. Storage drive 3 has been formatted by Windows and has data on it.

    If I format storage drive 3 in vSphere I will wipe the data. If I do not format storage drive 3 in vSphere, storage drive 3 cannot be accessed by the virtual machine.

    One way that I came up with to resolve this was to share storage drive 3 in Windows. If my vSphere virtual machine is Windows, I can map a network drive which allows me to move the data from storage drive 3 to storage drive 2.

    I have a feeling I am missing something here, and there probably is an easier way to make data on a storage drive accessible in vSphere.

    • Frank Thomas
      Frank Thomas about 8 years
      ok, to clarify, does the host need the drive, or a specific guest? It is possible (though unsupported) to attach a physical disk to a VM if thats what you need. If you want to use the disk for storage in a Datastore however, it must be reformatted to VMFS.
    • JeremyCanfield
      JeremyCanfield about 8 years
      @Frank Thomas, thank you for confirming that the disk must be formatted to be added to the datastore. I am glad to know I was not misunderstanding. In my scenario, the host needs the drive. Thank you also for mentioning that attaching a physical disk is unsupported. I will keep this in mind as I continue my VMWare journey! :)
  • JeremyCanfield
    JeremyCanfield almost 7 years
    This is a really neat solution!