Esxi forgotten notes

· seth's blog

#esxi #vmware

A long long while ago, I had done some extensive research and troubleshooting to recover data that I thought was lost on my homelab running VMWare ESXI at the time. (I have since come to my senses and I run all FOSS hosts now, so Proxmox is my current setup)

I think the original scenario was that there was some sort of corruption with the headers of the disks. I was running this software on totally unsupported hardware using community drivers, so these kinda things can happen. But I digress.

However, this was YEARS ago. But I'll try to go through what I was doing step by step. A post partum if you will.

First, it looks like I grabbed some information about the corrupted partitions:

[root@Sakurasou:~] partedUtil getptbl /dev/disks/mpx.vmhba32\:C0\:T0\:L0
gpt
121601 255 63 1953525168

Ah, I must be trying to figure out the beginning and end of the partitions on the disk. They must've moved somehow:

[root@Sakurasou:~] eval expr $(partedUtil getptbl /dev/disks/mpx.vmhba32:C0:T0:L
0 | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1
1953520064

Context: mpx means that I was likely messing with VMware local disks that were physical. Huh.

I'm getting a little bit lost here, but I vaguely remember digging into the vmdk itself to get this header information maybe? It's the thing that starts with "AA31E..."

[root@Sakurasou:~] partedUtil setptbl /dev/disks/mpx.vmhba32:C0:T0:L0 gpt "1 204
8 1953520064 AA31E02A400F11DB9590000C2911D1B8 0"
gpt
0 0 0 0
1 2048 1953520064 AA31E02A400F11DB9590000C2911D1B8 0

OK, so because I was trying to map the physical drive to a vmdk maybe? I am creating a new volume with the information I generated before :grimacing:

[root@Sakurasou:~] vmkfstools -C vmfs6 -S Disk1 /dev/disks/mpx.vmhba32\:C0\:T0\:
L0:1 
create fs deviceName:'/dev/disks/mpx.vmhba32:C0:T0:L0:1', fsShortName:'vmfs6', fsName:'Disk1'
deviceFullPath:/dev/disks/mpx.vmhba32:C0:T0:L0:1 deviceFile:mpx.vmhba32:C0:T0:L0:1
ATS on device /dev/disks/mpx.vmhba32:C0:T0:L0:1: not supported
.
Checking if remote hosts are using this device as a valid file system. This may take a few seconds...
Creating vmfs6 file system on "mpx.vmhba32:C0:T0:L0:1" with blockSize 1048576, unmapGranularity 1048576, unmapPriority default and volume label "Disk1".
Successfully created new volume: 5934307f-c5de3c76-d199-98ded0011e98

I am assigning labels so the VM knows what to do with the hard disks I'm assuming:

[root@Sakurasou:~] partedUtil mklabel /dev/disks/mpx.vmhba32\:C0\:T0\:L1 gpt
[root@Sakurasou:~] partedUtil mklabel /dev/disks/mpx.vmhba32\:C0\:T0\:L2 gpt
[root@Sakurasou:~] partedUtil mklabel /dev/disks/mpx.vmhba32\:C0\:T0\:L3 gpt

It looks like I was repeated the steps above for a Disk2, 3 and 4. Yikes.

[root@Sakurasou:~] partedUtil getptbl /dev/disks/mpx.vmhba32\:C0\:T0\:L1
gpt
121601 255 63 1953525168
[root@Sakurasou:~] partedUtil getptbl /dev/disks/mpx.vmhba32\:C0\:T0\:L2
gpt
121601 255 63 1953525168
[root@Sakurasou:~] partedUtil setptbl /dev/disks/mpx.vmhba32:C0:T0:L1 gpt "1 204
8 1953520064 AA31E02A400F11DB9590000C2911D1B8 0"
gpt
0 0 0 0
1 2048 1953520064 AA31E02A400F11DB9590000C2911D1B8 0
[root@Sakurasou:~] partedUtil setptbl /dev/disks/mpx.vmhba32:C0:T0:L2 gpt "1 204
8 1953520064 AA31E02A400F11DB9590000C2911D1B8 0"
gpt
0 0 0 0
1 2048 1953520064 AA31E02A400F11DB9590000C2911D1B8 0
[root@Sakurasou:~] partedUtil setptbl /dev/disks/mpx.vmhba32:C0:T0:L3 gpt "1 204
8 1953520064 AA31E02A400F11DB9590000C2911D1B8 0"
gpt
0 0 0 0
1 2048 1953520064 AA31E02A400F11DB9590000C2911D1B8 0
[root@Sakurasou:~] vmkfstools -C vmfs6 -S Disk2 /dev/disks/mpx.vmhba32\:C0\:T0\:
L1:1 
create fs deviceName:'/dev/disks/mpx.vmhba32:C0:T0:L1:1', fsShortName:'vmfs6', fsName:'Disk2'
deviceFullPath:/dev/disks/mpx.vmhba32:C0:T0:L1:1 deviceFile:mpx.vmhba32:C0:T0:L1:1
ATS on device /dev/disks/mpx.vmhba32:C0:T0:L1:1: not supported
.
Checking if remote hosts are using this device as a valid file system. This may take a few seconds...
Creating vmfs6 file system on "mpx.vmhba32:C0:T0:L1:1" with blockSize 1048576, unmapGranularity 1048576, unmapPriority default and volume label "Disk2".
Successfully created new volume: 593432bb-bc075680-94b7-98ded0011e98

I'm not sure of any of this was helpful, but I kept it for at least 6+ years in my notes up until this point.

If you have a better idea/explanation of what I was doing feel free to email me.

#esxi #vmware