这次公司机房需要临时停电,所以虚拟化这套设备需要停机一下,等我们弄完开机复电后,发现esxi始终连接不到存储,一开始以为网络和存储问题,但是最后都排除后,发现时分区表不见了,当时就全身发麻了。数据丢失了,经过我1天的查文档,做实验终于找到了恢复VMFS分区方法,并成功恢复了公司的数据。
这是我挂载的两个iscsi设备红框内2个。通过esxi shell 看看命令下的分区。
~ # ls /vmfs/devices/disks/
mpx.vmhba1:C0:T0:L0 vml.0000000000766d686261313a303a30
mpx.vmhba1:C0:T0:L0:1 vml.0000000000766d686261313a303a30:1
mpx.vmhba1:C0:T0:L0:2 vml.0000000000766d686261313a303a30:2
mpx.vmhba1:C0:T0:L0:3 vml.0000000000766d686261313a303a30:3
mpx.vmhba1:C0:T0:L0:5 vml.0000000000766d686261313a303a30:5
mpx.vmhba1:C0:T0:L0:6 vml.0000000000766d686261313a303a30:6
mpx.vmhba1:C0:T0:L0:7 vml.0000000000766d686261313a303a30:7
mpx.vmhba1:C0:T0:L0:8 vml.0000000000766d686261313a303a30:8
t10.FreeBSD_iSCSI_Disk______000c29ae3a55000_________________ vml.020000000030000000f85265f3695343534920
t10.FreeBSD_iSCSI_Disk______000c29ae3a55001_________________ vml.0200010000300000000a39e6f0695343534920
/vmfs/devices/disks/t10.FreeBSD_iSCSI_Disk______000c29ae3a55000_________________ ------>datastore
/vmfs/devices/disks/t10.FreeBSD_iSCSI_Disk______000c29ae3a55000_________________:1 ------>partition
~ # partedUtil getptbl /vmfs/devices/disks/t10.FreeBSD_iSCSI_Disk______000c29ae3a55000_________________
1 2048 104857566 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
~ # ls /vmfs/devices/disks/
mpx.vmhba1:C0:T0:L0 vml.0000000000766d686261313a303a30
mpx.vmhba1:C0:T0:L0:1 vml.0000000000766d686261313a303a30:1
mpx.vmhba1:C0:T0:L0:2 vml.0000000000766d686261313a303a30:2
mpx.vmhba1:C0:T0:L0:3 vml.0000000000766d686261313a303a30:3
mpx.vmhba1:C0:T0:L0:5 vml.0000000000766d686261313a303a30:5
mpx.vmhba1:C0:T0:L0:6 vml.0000000000766d686261313a303a30:6
mpx.vmhba1:C0:T0:L0:7 vml.0000000000766d686261313a303a30:7
mpx.vmhba1:C0:T0:L0:8 vml.0000000000766d686261313a303a30:8
t10.FreeBSD_iSCSI_Disk______000c29ae3a55000_________________ vml.020000000030000000f85265f3695343534920
t10.FreeBSD_iSCSI_Disk______000c29ae3a55001_________________ vml.0200010000300000000a39e6f0695343534920
t10.FreeBSD_iSCSI_Disk______000c29ae3a55001_________________:1 vml.0200010000300000000a39e6f0695343534920:1
t10.FreeBSD_iSCSI_Disk______000c29ae3a55000_________________ vml.020000000030000000f85265f3695343534920
~ # partedUtil getptbl /vmfs/devices/disks/t10.FreeBSD_iSCSI_Disk______000c29ae3a55000_________________
1 2048 146800606 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
~ # partedUtil getptbl /vmfs/devices/disks/t10.FreeBSD_iSCSI_Disk______000c29ae3a55000_________________
partedUtil setptbl “/vmfs/devices/disks/divce id “gpt " 1 2048 104857566 AA31E02A400F11DB9590000C2911D1B8 0 "
1 表示第一个分区,是主分区。2048表示vmfs-5分区开始扇区 。AA31E02A400F11DB9590000C2911D1B8 是VMFS GUID 其他都照着写就是了。
~ # partedUtil setptbl "/vmfs/devices/disks/t10.FreeBSD_iSCSI_Disk______000c29ae3a55000_________________" gpt "1 2048 104857566 AA31E02A400F11DB9590000C2911D1B8 0" 回车
1 2048 104857566 AA31E02A400F11DB9590000C2911D1B8 0