The quick answer is no, reinstalling ESXi on a host that contained VSAN data will not be touched or destroyed. This, of course, assumes you do not touch any of the disks that contains your VSAN data. To further assist administrators, you can also see which disks are claimed by VSAN during the the disk selection of a reinstall/upgrade of ESXi, so the proper disk is selected.

reinstall-esxi-with-esxistig-vsan-datastore-0
This to me is a very important fact and probably a very conscious design decision by the VSAN Engineers to ensure that you do not accidentally wipe your data because ESXi needed to be reinstalled. The topic has been one I have been wanting to write about for awhile but just never found the time. The reason I am bringing this up is that I saw an interesting tweet the other day from fellow VMware colleague, Geordy Korte who works over in the NSBU that had the following request:

Geordy needed to reinstall ESXi but he did not want to lose any of the VSAN data residing on the disks within the ESXi host which also contained his vCenter Server among other Virtual Machines. Fortunately, reinstalling ESXi is a very safe operation and it will not touch any of the VSAN partitions. In fact, after the installation, if ESXi detects there are partitions that contains VSAN data, it will automatically claim the devices for you. You may have even seen this as part of the ESXi boot process:

reinstall-esxi-with-esxistig-vsan-datastore-0.1
Going back to Geordy's original question, how do you re-create the VSAN Datastore after reinstalling ESXi? Well, the process is actually pretty straight forward and is quite similar to how you bootstrap vCenter Server onto a VSAN Datastore. To demonstrate this process, I decided to take a fully functional 3-Node VSAN setup that contained a Virtual Machine and reinstall ESXi on all three nodes. I will now take you through the process of restoring the VSAN Datastore and at the end I will also talk about an alternative approach depending on the situation you might be in.

Step 1 - You can easily check whether you have an existing VSAN Disk Group by running the following ESXCLI command:

esxcli vsan storage list

reinstall-esxi-with-esxistig-vsan-datastore-1
Step 2 - You will need to enable VSAN traffic type for the VMkernel interface you wish to run VSAN on by running the following command and specifying the interface (this will need to be done on ALL ESXi hosts):

esxcli vsan network ipv4 add -i vmk0

Step 3 - You will need to re-create a new VSAN Cluster and you can do so by running the following command which will generate a UUID and create a VSAN Cluster from that:

esxcli vsan cluster join -u $(python -c 'import uuid; print str(uuid.uuid4());')

reinstall-esxi-with-esxistig-vsan-datastore-2
Step 4 - Once the VSAN Cluster has been created, you will need to make a note of the UUID that was generated so you can join the remaining ESXi hosts to the same VSAN Cluster. To do so, you will need to run the following command:

esxcli vsan cluster get

You will need to look for "Sub-Cluster UUID" property as seen in the screenshot above highlighted in green.

Step 5 - On the remainder ESXi hosts, you can now join the the VSAN Cluster using the following command and specifying the UUID from the previous step:

esxcli vsan cluster join -u [UUID]

reinstall-esxi-with-esxistig-vsan-datastore-3
Step 6 - Once all ESXi hosts have re-joined the VSAN Cluster, you can now go into the VSAN Datastore and re-register all the Virtual Machines using either the vSphere C# Client or from the CLI on the ESXI Shell.

reinstall-esxi-with-esxistig-vsan-datastore-5

reinstall-esxi-with-esxistig-vsan-datastore-4
As you can see from the screenshot above, I was able to recover my Virtual Machine and there was no data loss!

If you recall earlier, I also mentioned there was an alternative approach that you could take depending on the situation. If you need to deploy a new vCenter Server for what ever reason, you can easily restore your existing VSAN Cluster by simply creating a new VSAN Cluster in the new vCenter Server. You would then add each ESXi hosts to the VSAN Cluster and the VSAN Datastore and its contents will automatically be restored without any issues. Once you have your VSAN Datastore, you can then re-create the missing VM Storage Policies and re-apply them to the respective Virtual Machines.

In this article I have described two potential scenarios when working with VSAN and in both cases you can safely recover your data without any problems. This is one of the things I have come to appreciate about VSAN is the amount of engineering effort to make it super simple to use but also very resilient!

6 thoughts on “Does reinstalling ESXi with an existing VSAN Datastore wipe your data?

  1. Thanks for sharing!

    While I have a question for your point:

    “If you need to deploy a new vCenter Server for what ever reason, you can easily restore your existing VSAN Cluster by simply creating a new VSAN Cluster in the new vCenter Server. You would then add each ESXi hosts to the VSAN Cluster and the VSAN Datastore and its contents will automatically be restored without any issues.”

    What will happen when a DVS was configured in old vCenter server and ESX servers were using it?

  2. So, when running a virtualized lab, I rebuild ESXi hosts constantly, but I want them to come up with clean disks. Is there a simple command I could run to wipe the disks? Using Fusion 7.1 I don’t want to have to remove and re-add disks because of the special disk settings required for running vSAN.

  3. William, I have a situation were I need to reinstall ESXi on all my VSAN 5.5 nodes. No need to go into details why that is. I have a four node cluster with two disk groups per node. Once each host is rebuilt, I will have to rejoin it back to the VSAN cluster using the method above before going to the next host. My question pertains to which maintenance mode to use on the host prior to reinstalling ESXi, ‘ensure accessibility’ or ‘full data migration’. Will ‘ensure accessibility’ be good enough and when I rejoin the host back to the VSAN will the existing data be recognized by the cluster. Or am I better off doing a ‘full data migration’ even if it means the storage won’t be balanced across hosts when I’m done with the re-installs?

    • To clarify the question above, I’m talking about reinstalling ESXi on each VSAN node in a four node cluster in a rolling manner without taking an outage on running VMs.

      • Jose,

        You’ll want to take a look at the VSAN Operational Guide which covers rebuild. For your scenario, if the host will be back within the default 30min (IIRC), then VSAN will not automatically rebuild the data, but if it will take longer and you have selected ensureAccessiblity, then it’ll start the rebuild process. If you plan to decommission or it may take longer to re-install, then you may opt for the full data migration with the note that it’ll take a bit longer to move all data off the disks. Definitely recommend checking out the official docs which should cover this use case

  4. Hello William,

    By accident, one of my customers remove a Disk Group from VSAN Cluster to replace a disk without set the host in maintenance mode and flush the VMs, I know will be difficult, but there is any way or chance to recover those VMs inside that Disk Group? Please if you can let me know as soon you can, this is critical for my client

    Thanks in advance

Thanks for the comment!