VMware Cloud Community
stehof
Contributor
Contributor

Restore datastore after move

Hello,

I’m totally new into VMware and I’m having an issue that I doesn’t seem to get solved.

I have a Raspberry Pi 4B with VMware ESXI on it, I had 2 datastore (2 USB drives). 1 datastore for the system and the 2nd for my machines.

The drive with the system files got corrupted so I had to reinstall ESXI, now I want to use the 2nd drive again as my datastore for the machines but the system doesn’t sees the drive.

Any ideas how I could fix this?

0 Kudos
11 Replies
a_p_
Leadership
Leadership

Moderator: Moved to ESXi-Arm Fling

0 Kudos
e_espinel
Virtuoso
Virtuoso

Hello.
Did you reinstall VMware vSphere on the same USB drive you were using ? or did you reinstall using a new USB Drive ?

If you reinstall on the same USB drive, was the old partition detected and which option did you choose?

e_espinel_1-1621192876857.png

Depending on the option you chose, you may have lost your data.

 

Enrique Espinel
Senior Technical Support on IBM, Lenovo, Veeam Backup and VMware vSphere.
VSP-SV, VTSP-SV, VTSP-HCI, VTSP
Please mark my comment as Correct Answer or assign Kudos if my answer was helpful to you, Thank you.
Пожалуйста, отметьте мой комментарий как Правильный ответ или поставьте Кудо, если мой ответ был вам полезен, Спасибо.
0 Kudos
stehof
Contributor
Contributor

Hi,

yes I did reinstall the VMware esxi on the same usb drive as before.

when it was up again and I assigned the right static IP, then I plugged in the USB again with the 2nd datastore with my machines, but it doesn’t show up as a device.

Or is there a setting preventing this from showing as security?

0 Kudos
cyprienlaplace
VMware Employee
VMware Employee

Hi, have you disabled the usbarbitrator again? You need it disabled or the second disk is considered for USB passthrough and not as datastore for ESXi.

 

/etc/init.d/usbarbitrator stop
chkconfig usbarbitrator off

stehof
Contributor
Contributor

Thanks, that solved the issue from not seeing the device and datastore.

So the datastore is visible now and I can see the files and machines. But somehow the files doesn't seem to be accessible, if I try to copy the .vmdk for example, it gives me this error:

Key

haTask--vim.VirtualDiskManager.copyVirtualDisk-3489637614

Description

Copy the disk, either a datastore path or a URL referring to the virtual disk

State

Failed - A general system error occurred: Invalid argument

Errors


And when I try to register the machine by Create / Register VM > Register an exciting virtual machine > select DS2 and the right .vmx > Finish it will add the machine, but the state is Invalid and I'm not able to do anything with it.
This is the output of the task after import:

Key

haTask-ha-folder-vm-vim.Folder.registerVm-3489637651

Description

Adds an existing virtual machine to the folder

Folder:

 

State

Completed successfully

Errors

 

So then I created a totally new VM with the right settings, during the setup I choice to add a HDD and choice the existing .vmdk file from the machine, after creating I tried to power it up, but still nothing, he won't power up, this is the output:

Key

haTask-6-vim.VirtualMachine.powerOn-3489637579

Description

Power On this virtual machine

Virtual machine:
State

Failed - File system specific implementation of OpenFile[file] failed

Errors

 

  • File system specific implementation of OpenFile[file] failed
  • 22 (Invalid argument)
  • Cannot open the disk '/vmfs/volumes/5f4e5df7-d0c2d2fc-58c6-dca632d62882/Unify/Unify.vmdk' or one of the snapshot disks it depends on.
  • Module 'Disk' power on failed.
  • Failed to start the virtual machine.

Any thoughts what I could do to fix this?

0 Kudos
cyprienlaplace
VMware Employee
VMware Employee

Hi, I see two potential issues here.

The first one for the invalid state: it might be because of the hwversion of the VM. The latest release got a little more restrictive. Make sure it says 'virtualHW.version = "17"' in the .vmx file.

For the second issue about vmdk, simply copying the vmdk to a VMFS filesystem is not enough, you need to go through some importation tool. See https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.storage.doc/GUID-01D3CF47-A84A-4988... for the command. e.g: 

vmkfstools -i /vmfs/volumes/myVMFS/templates/gold-primary.vmdk /vmfs/volumes/myVMFS/myOS.vmdk -d thin
0 Kudos
stehof
Contributor
Contributor

Thanks for the help, I tried the command but it failed because he couldn't find such file.

Then I run "ls -la /vmfs/volumes/myVMFS/" of course I filled out myVMFS with the right folder for my datastore, and I saw that the templates folder doesn't seem to exist.

Another Issue why the machines doesn't seem to start, there is a .lck file in the directory but it won't let me remove it, when I cd into the folder and command "rm Unify.vmx.lck" it says "rm: remove 'Unify.vmx.lck'?" and replied Y, y, Yes, yes and YES but nothing seem to do the trick, also just enter it don't delete the file...

0 Kudos
stehof
Contributor
Contributor

Any suggestions..? Anybody?

0 Kudos
cyprienlaplace
VMware Employee
VMware Employee

Hi,

On the command line "vmkfstools -i /vmfs/volumes/myVMFS/templates/gold-primary.vmdk /vmfs/volumes/myVMFS/myOS.vmdk -d thin"

  • /vmfs/volumes/myVMFS/templates/gold-primary.vmdk  is the name of the disk you want to copy.
  • /vmfs/volumes/myVMFS/myOS.vmdk is the destination name, for the copy.

Cyprien

0 Kudos
stehof
Contributor
Contributor

Hi Cyprien,

Thanks, I did try that exact command (like: "vmkfstools -i //vmfs/volumes/MY_Data_STORE/Unify/Unify.vmdk /vmfs/volumes/MY_Data_STOREunifyController/Unify.vmdk -d thin") but it failed with this error: "Invalid argument (1441801)."

I thinks it has something to do with the .lck file that I'm not able to remove. Because the ESXi server crashed when the machine were on (I guess...) there is a VMname.vmx.lck file in the folder which won't let itself be deleted.

When I command "vmkfstools -D /vmfs/volumes/<My_DATA_STORE>/Unify/Unify.vmx" this is the output:

Lock [type 10c00001 offset 7643136 v 96, hb offset 3702784
gen 253, mode 1, owner 5f4e5638-df2877ea-b962-dca632d62882 mtime 4734
num 0 gblnum 0 gblgen 0 gblbrk 0]
Addr <4, 0, 21>, gen 25, links 1, type reg, flags 0, uid 0, gid 0, mode 100755
len 3496, nb 0 tbz 0, cow 0, newSinceEpoch 0, zla 4305, bs 65536
affinityFD <4,0,20>, parentFD <4,0,20>, tbzGranularityShift 20, numLFB 0
lastSFBClusterNum 0, numPreAllocBlocks 0, numPointerBlocks 0

 

And when I CD into the folder of the machine and command LS -LA, this is the output:

drwxr-xr-x    1 root     root         77824 Sep  2  2020 .
drwxr-xr-t    1 root     root         73728 Sep  1  2020 ..
-rw-------    1 root     root     2147483648 Nov 14  2020 Unify-e8f544e3.vswp
-rw-------    1 root     root     34359738368 Nov 14  2020 Unify-flat.vmdk
-rw-------    1 root     root        270840 Nov 14  2020 Unify.nvram
-rw-------    1 root     root           499 Sep  2  2020 Unify.vmdk
-rw-r--r--    1 root     root             0 Sep  1 15:28 Unify.vmsd
-rwxr-xr-x    1 root     root          3496 Sep  2  2020 Unify.vmx
-rw-------    1 root     root             0 Sep  2  2020 Unify.vmx.lck
-rw-------    1 root     root           154 Sep  2  2020 Unify.vmxf
-rwxr-xr-x    1 root     root          3391 Sep  2  2020 Unify.vmx~
-rw-r--r--    1 root     root        297383 Sep  1  2020 vmware-1.log
-rw-r--r--    1 root     root        175795 Sep  2  2020 vmware-2.log
-rw-r--r--    1 root     root        369772 Sep  2  2020 vmware-3.log
-rw-r--r--    1 root     root      11532535 Nov 14  2020 vmware.log
-rw-------    1 root     root      90177536 Sep  2  2020 vmx-Unify-8854f0be9f7dbd34ba697eabc2cf489d41d4ac65-1.vswp

So the .vmdk file that I see in the web GUI while browsing the datastore, is still locked and the data is stored under Unify-flat.vmdk, but I tried every single suggestion of the forum but I still can't unlock it or do anything with the Unify-flat.vmdk file...

0 Kudos
stehof
Contributor
Contributor

Here you can see the status of the locked vmx file: 

/vmfs/volumes/MY_DATA_STORE/Unify] vmfsfilelockinfo -p /vmfs/volumes/MY_DATA_STORE/Unify/Unify.vmx -i

vmfsfilelockinfo Version 2.0

Looking for lock owners on "Unify.vmx"
"Unify.vmx" is locked in Exclusive mode by host having mac address ['xx:xx:xx:xx:xx:xx']
Trying to use information from VMFS Heartbeat

Host owning the lock on file is 192.168.0.10, lockMode : Exclusive
Total time taken : 4.8159201670005132 seconds.

0 Kudos