Recently I wanted to copy a VMFS volume from one site to another but the VMFS volume did not automatically mount at the new site.
Using my storage array’s replication technology I replicated the LUN (containing an existing VMFS Datastore) from site A to site B, broke off the replication to make the LUN at site B writable and mapped the LUN to the ESXi hosts at Site B. When I then performed a rescan for Datastores at Site B I was expecting the Datastore to appear, however it never. The LUN was detected by each of the ESXi hosts at Site B as I could see it when looking at the devices detected via the storage adapters.
To mount the datastore at site B I had to resort to the command line, either by SSH to the ESXi host or via the Remote CLI
From a SSH session on the ESXi host run the following commands:
This lists the volumes that have been detected as snapshots/replicas and therefore did not mount.
You can then persistently mount the volume by using the following command with the UUID of the volume as displayed in the previous command
esxcfg-volume –M <UUID>
Note: that it needs to be a capital “M” as a lower case “m” will perform a temporary mount of the datastore, not a persistent mount; therefore it will no longer be mounted following a reboot of the host.
Here is an example of where I have run the command from a host
You need to repeat this on all of the ESXi hosts at site B.
From the Remote CLI use the vicfg-volume.pl commands instead of esxcfg-volume and specify the ESXi host you want to run the command against, i.e.
vicfg-volume.pl –server <esxi-host> -l
vicfg-volume.pl –server <esxi-host> -M <UUID>
When you run these command you will need to specify a username and password to connect to the ESXi hosts, e.g. root. Here is an example.
You can also connect to the vCenter server and provide a vCenter administrator username and password instead of connecting directly to the ESXi host when using vicfg-volume.pl, when doing this you also need to specify the ESXi hosts you want to run the command on by specifying the –vihost parameter. Note: you need to specify the ESXi host as it is listed in the vCenter inventory, e.g. if it is listed with the fully qualified domain name you need to specify this on the –vihost parameter, e.g.
vicfg-volume.pl –server <vcenter-server> –vihost <esxi-host> -l
vicfg-volume.pl –server <vcenter-server> –vihost <esxi-host> -M <UUID>
Although I found that I could only do this for the first host and when I attempted to mount the Datastore on subsequent hosts I get the error message
A VMFS volume with the same UUID ‘<UUID>’ is already mounted in the datacenter.
So I reverted back to connecting directly to the ESXi host with vicfg-volume.pl.
Note: there is no –m option on vicfg-volume