VMware Cloud Community
spiffeluringen
Contributor
Contributor

New datastore using old partition

Is it still possible to create a new datastore in the same place without destroying the files present, if you use the same name and partitioning options? This is esxi 6.7

I remember having done this in esxi 5 (maybe 5.5), after a reboot the datastore was missing and I could not see it anyware, after giving up regaining the datastore I decided to just create a new datastore and use the backups, but afterwords all files where there and working..

As you can see the device is visible.

datastore1.PNG

 

 

0 Kudos
27 Replies
spiffeluringen
Contributor
Contributor

Next step

 

0 Kudos
spiffeluringen
Contributor
Contributor

Last step

 

 

 

Tags (1)
0 Kudos
a_p_
Leadership
Leadership

If the data on the disk/LUN is still ok, it's usually possible to recreate the partition, so that the data on that partition can be accessed again. This needs to be done from the command line!
Recreating the datastore from the UI - as in your screenshots - will create a VMFS partition, but will also format it, i.e. overwrite partition data. So don't do that!

André

0 Kudos
spiffeluringen
Contributor
Contributor

Ok so what needs to be done then?

Is the CLI way non format by design?

0 Kudos
a_p_
Leadership
Leadership

First, it is necessary to check the current state. To do this, please run the offset ...; done command line from https://communities.vmware.com/t5/ESXi-Discussions/Problem-recreating-VMFS-partitions/td-p/2273481 on the ESXi host's console (there used to be a KB article for this, but VMware dropped it for whatever reason).
If the result shows the LUN with the datastore that you are looking for, run partedUtil getUsableSectors /vmfs/devices/disks/... for that LUN too, and post the results of both commands (for the first command, only the data for the LUN in question).

André

0 Kudos
batuhandemirdal
Enthusiast
Enthusiast

Hi,

 

Have you tried to create it in different datastore?

0 Kudos
spiffeluringen
Contributor
Contributor

I´m not sure what you mean, are you asking if I have tried to create the datastore in another datastore??

0 Kudos
spiffeluringen
Contributor
Contributor

"If the data on the disk/LUN is still ok"


I´m trying to verify this from an Ubuntu machine with vmfs6-tools but when trying to mount the disk it says command not found.

With vmfs-tools it gives me an error


[root@VMESXi6:~] partedUtil getUsableSectors /vmfs/devices/disks/naa.600605b009e5ca201caeb6cc0e5e2939
34 4683591646

Regarding the offset is this the command you want me to run?

offset="128 2048"; for dev in `esxcfg-scsidevs -l | grep "Console Device:" | awk {'print $3'}`; do disk=$dev; echo $disk; partedUtil getptbl $disk; { for i in `echo $offset`; do echo "Checking offset found at $i:"; hexdump -n4 -s $((0x100000+(512*$i))) $disk; hexdump -n4 -s $((0x1300000+(512*$i))) $disk; hexdump -C -n 128 -s $((0x130001d + (512*$i))) $disk; done; } | grep -B 1 -A 5 d00d; echo "---------------------";

0 Kudos
a_p_
Leadership
Leadership

Yes, the command run for all detected devices.
What's needed is the output for "naa.600605b009e5ca201caeb6cc0e5e2939"

André

0 Kudos
spiffeluringen
Contributor
Contributor

If I run it the exactly that way I dont get anything, or does it take time?

0 Kudos
a_p_
Leadership
Leadership

Sorry, I dodn't look close enough.
The command line is missing "; done" at the end.

André

0 Kudos
spiffeluringen
Contributor
Contributor

So

 

offset="128 2048"; for dev in `esxcfg-scsidevs -l | grep "Console Device:" | awk {'print $3'}`; do disk=$dev; echo $disk; partedUtil getptbl $disk; { for i in `echo $offset`; do echo "Checking offset found at $i:"; hexdump -n4 -s $((0x100000+(512*$i))) $disk; hexdump -n4 -s $((0x1300000+(512*$i))) $disk; hexdump -C -n 128 -s $((0x130001d + (512*$i))) $disk; done; } | grep -B 1 -A 5 d00d; echo "---------------------"; done

0 Kudos
a_p_
Leadership
Leadership

Yes, looks ok now with the do..done closed.

André

0 Kudos
spiffeluringen
Contributor
Contributor

/vmfs/devices/disks/naa.600605b009e5ca201caeb6cc0e5e2939
gpt
291540 255 63 4683591680
1 2048 4683591646 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
Checking offset found at 2048:
0200000 d00d c001
0200004
1400000 f15e 2fab
1400004
0140001d 44 41 54 41 53 54 4f 52 45 31 00 00 00 00 00 00 |DATASTORE1......|
0140002d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|

0 Kudos
a_p_
Leadership
Leadership

Everything seems to be ok with the partition.
If the datastore doesn't show up, please run esxcli storage vmfs snapshot list to see whether it is detected as a snapshot LUN, and mountable.If it is, see step 3 in the "Command line" section of https://kb.vmware.com/s/article/1011387 for how to mount it.

André

0 Kudos
spiffeluringen
Contributor
Contributor

Well something is wrong

[root@VMESXi6:~] esxcli storage filesystem list
Error getting data for filesystem on '/vmfs/volumes/551b50cd-4562d988-2331-40f2e9a61a78': Cannot open volume: /vmfs/volumes/551b50cd-4562d988-2331-40f2e9a61a78, skipping.

and

esxcli storage vmfs snapshot list gives nothing

0 Kudos
a_p_
Leadership
Leadership

For that kind of errors, I think we should not proceed with trial&error, but wait for @continuum (or contact him).

André

spiffeluringen
Contributor
Contributor

Lots of these in vmkwarniing but the fault disk is still in the machine, should i just remove it?

2021-03-07T15:51:09.174Z cpu1:2098928 opID=81c81fd8)WARNING: Fil3: 1464: Failed to reserve volume f530 28 1 551b50cd 4562d988 f2402331 781aa6e9 0 0 0 0 0 0 0
2021-03-07T15:51:09.372Z cpu1:2098928 opID=81c81fd8)WARNING: HBX: 2430: Failed to initialize VMFS distributed locking on volume 551b50cd-4562d988-2331-40f2e9a61a78: I/O error
2021-03-07T15:51:09.372Z cpu1:2098928 opID=81c81fd8)WARNING: Fil3: 1464: Failed to reserve volume f530 28 1 551b50cd 4562d988 f2402331 781aa6e9 0 0 0 0 0 0 0
2021-03-07T15:51:09.552Z cpu1:2098928 opID=81c81fd8)WARNING: HBX: 2430: Failed to initialize VMFS distributed locking on volume 551b50cd-4562d988-2331-40f2e9a61a78: I/O error
2021-03-07T15:51:09.552Z cpu1:2098928 opID=81c81fd8)WARNING: Fil3: 1464: Failed to reserve volume f530 28 1 551b50cd 4562d988 f2402331 781aa6e9 0 0 0 0 0 0 0

0 Kudos
continuum
Immortal
Immortal

As far as I know most admins seem to translate "cant do xy - IO-error" as "VM, vmdk or complete datastore has massive problems and nothing can be done to get over it"

Do not draw any radical conclusions like giving up a datastore just because of I/O errors - chances are good that the message is just a bluff.

Ulli


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos