How to remove and add diskgroup via commandline in vSAN

Welcome to new blog post and today we are going to look at vSAN disk group removal & addition.

Here, I am using one ESXi host with two diskgroups each having one SSD & one HDD. As of now both the diskgroups are mounted & in healthy state.

I am going to remove them via command line and add them back again.

Take putty session of ESXi host and run vdq -i to identify the diskgroups placement. This shows that I have two diskgroups each with one SSD and one MD

Place the host in the maintenance-mode and run the below command to delete first diskgroup. We are using -s which will remove the cache SSD and its capacity members in the diskgroup. Verified by running vdq -i we do not see first diskgroup

Let’s remove the second one also by running the same command

You can see that in the webclient, we do not see any more diskgroups associated with

Now, lets check the impact of diskgroup removal. Here, when I go to storage devices and check the partition I do not see any vSAN & Virsto partition information which means that diskgroup removal removes the partition and format the devices

Now, its time to form the diskgroups back. Use below commands localcli vsan storage add -s SSD -d HDD -d HDD -d HDD ( for multiple HDDs)

This operation is going to format and partition the SSD or HDD with vSAN metadata and Virsto file system

We can check that in webclient and two diskgroups are associated with but disks vSAN health status is not showing because of nested environment. In next steps , I am going to unmount the diskgroup and mount it back which would resolve this.

In below screenshot you can see that disk partition information in storage devices. It is showing two partitions one is vSAN metadata and seconds is vSAN filesystem

In order to fix vsan disk health issue, I am going to unmount the disk group and remount it back. In the below screenshot you can see that I unmounted first diskgroup and checked the status in cmmds which is showing false

In webclient you can see the diskgroup status which shows unmounted & flash is down

Run the below command to mount it back and check the cmmds status which is true for all the disks on this host

Repeat unmount & remount for second diskgroup also and in webclient you can now the vsan disk health status is showing healthy.


I hope this has been informative for you. Thank you for reading!!