Sadly, one of hard disks for ESXi server died. I put in a replacement disk but one of VMs doesn’t start as not having the disk. So, I need to delete the old disk node, create new one, and set up in the VM.
Before installing disk, take a note on the disk serial number. (S/N) This comes in handy to ID the disk in the process. More over, you should label the S/N near SATA port to make life easier.
Log in to ESXi via SSH as root. Then, check the disks.
# ls -l /vmfs/devices/disks
You’ll see a bunch but you should be able to ID the disk you just put in if you know the S/N. Since I’m stubborn, I want to use the same “hitachi_2tb_2.vmdk”, I first deleted the vmdk file. You actually need to delete two files.
“`rm /vmfs/volumes/5bb18636-fccb7c8a-78c8-001b214ff43c/XigmaNAS/hitachi_2tb_2.vmdk /vmfs/volumes/5bb18636-fccb7c8a-78c8-001b214ff43c/XigmaNAS/hitachi_2tb_2-rdmp.vmdk“`
Then, time to recreate using the disk I just installed. Following command creates a pass-through disk for the VM.
NOTE: This step is no longer needed for ESXi 7 as you have an option to add the raw disk to VM and no need to ues vmkfstools anymore.
vmkfstools -z /vmfs/devices/disks/t10.ATA_____Hitachi_HDS722020ALA330_______________________JK11A8YBKTGMDF /vmfs/volumes/5bb18636-fccb7c8a-78c8-001b214ff43c/XigmaNAS/hitachi_2tb_2.vmdk
Now time to go to the ESXi web interface and create a new disk. First, delete the dead disk from the settings. Then “Add New Disk” and pick “Existing disk” and choose the VMDK file you just created.
You are done with the VM setting. Now, go into the XigmaNAS.
First, “Disks” > “Management” > HDD Management. If you don’t see the new device not showing up, “Import Disks” [Import].
Second, format the disk you just put in. It’s “Disks” > “Management” > “HDD Format”. Pick “ZFS Storage Pool”. Choose the disk. (Serial Number shows up here as well.) Click “Next” and format. (pretty quick.)
Third, “Disks” > “ZFS”> “Pools” > “Tools”. ZFS Pool knows that the disk is changed. Chose “Replace a device” to replace the dead disk to the new one. Once you are done, it should start recovering the mirror.