VMware VSA Export VMs from broken appliances
So the title sounds disastrous and its a fact that I had recently faced the issue at one of our customers where one of the VSA ESXi nodes failed due to hardware issues and the second VSA node didn’t export the replica datastore and instead it went into maintenance mode:
Even when we got the faulty node up the status of the VSA appliances remained the same and both were in maintenance mode, whenever you try to exit them from maintenance mode (using both GUI and CLI) the VSA appliances will reboot around 5 times and will get themselves back into maintenance mode.
After calling VMware support, it seems that the database on both VSA appliances was corrupted so the logical question was to ask them if there is away to just export the NFS datastore so that we can retrieve the virtual machines, finally after jumping through a couple of engineers someone from the escalation team gave me what I want, and I thought I would share it here because it WILL help you a lot in case you got stuck in such a situation.
Lets do this:
- First log-on to any of the ESXi hosts and power off one of the VSA appliances (only one appliance should be present).
- Open the console and logon to that VSA appliance using svaadmin:svapass.
- Change into super user: sudo su –
- Type: vgchange -ay ( you should get something like [2 logical volume(s) in volume group “SVAVolGroup00” now active]).
- Type: ls /dev/SVAVolGroup00/ (you should get something like [V0000000D0000001 V0000001D0000000] where these are the split datastore).
- MDADM: This is the Linux utility to manage the RAID array as such type (the result will include MD_LEVEL, MD_DEVICES, MD_NAME, MD_UUID, MD_UPDATE_TIME, MD_DEV_UUID, MD_EVENTS):
- mdadm – -examine – -export /dev/SVAVolGroup00/V0000000D0000001
- mdadm – -examine – -export /dev/SVAVolGroup00/V0000001D0000000
- Now we need to stop the firewall:
- /etc/init.d/SuSEfirewall2_setup stop
- /etc/init.d/SuSEfirewall2_init stop
- MDADM (result will be like [mdadm: /dev/md0 has been started with 1/2 drive (out of 2)]:
- mdadm – -assemble – -run – -force /dev/md0 /dev/SVAVolGroup00/V0000000D0000001
- mdadm – -assemble – -run – -force /dev/md0 /dev/SVAVolGroup00/V0000001D0000000
- Start the NFS server service: service nfsserver start (output will be something like [Starting kernel based NFS server: idmapd mountd statd nfsd sm-notify done]).
- Mounting the volumes:
- mkdir /exports/V0000000D0000000
- mkdir /exports/V0000001D0000001
- mount -rw -o barrier=0,data=ordered,nodelalloc,errors=panic /dev/md0 /exports/V0000000D0000000
- mount -rw -o barrier=0,data=ordered,nodelalloc,errors=panic /dev/md1 /exports/V0000001D0000001
- exportfs -o rw,no_root_squash,sync,no_all_squash,insecure :/exports/V0000000D0000000
- exportfs -o rw,no_root_squash,sync,no_all_squash,insecure :/exports/V0000001D0000001
- After using the exportfs command you should get something like [exportfs: No host name given with /exports/V0000000D0000000 …etc… to avoid warning] this means that the volumes were exported successfully.
- Verify volumes before adding them to the ESXi hosts:
- Type: ls -als /exports/V0000000D0000000 and ls -als /exports/V0000000D0000000 and you should see the virtual machines residing in them.
- Finally you can go to the host configuration -> storage -> add the new NFS datastores /exports/V0000000D0000000 and /exports/V0000000D0000000 using the IP address of the VSA appliance.
- Make sure you move the virtual machines out of the NFS datasore and keep them safe because you will need to delete the VSA cluster and start a new one from scratch.
Hopefully this will send you back home early to sleep rather than staying up all night eating your fingernails and drinking caffeine ;-).