VMware Cloud Community
redyouch
Enthusiast
Enthusiast

Restore Deleted Datastore?

My ESXi 3.5 installation had 3 datastores. I clicked one, then remove and it ended up removing 2 datastores... The second one that it "accidentally" removed is being used by production virtual servers. These servers are still online using virtual disks stored on this now deleted datastore, despite this datastore not being online or visible. When I go to add a new datastore, this disk is on the list, and I am informed that all data will be lost if I try to recreate it. What I am asking is how to I "undelete" this datastore that was accidentally deleted. The virtual machines are still online!

Thank you for your help.

Reply
0 Kudos
3 Replies
nick_couchman
Immortal
Immortal

Have you done any searches around this forum for this issue? I know it has been discussed before and that a few solutions were presented. I don't think any of the solutions are "online" ones, though - to recover correctly you're going to need to take down your ESX(i) hosts, or at least shut down all the running VMs. Might want to back up that block device that contains the VMs, too, if possible...

redyouch
Enthusiast
Enthusiast

There was only one server that we ended up loosing. I was able to backup or transfer over the data from the rest of them. Is this just a glitch in ESXi, or did I do something wrong?

What is the correct methodology for removing storage?

Reply
0 Kudos
DLwig
Contributor
Contributor

I'm running ESXi 4.0 and I too deleted a datastore on accident. I made sure not to re-format the volume and instead paid the $300 for support. This is how they fixed it:

Locate the disk that contains the deleted datastore by using the fdisk -l command:

  1. fdisk -l

Disk /dev/disks/naa.5007116091c12199a2471bcc15bade11: 2136.7 GB, 2136746229760 bytes

255 heads, 63 sectors/track, 259777 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

*other disks removed from this example

Execute fdisk on the located disk:

  1. fdisk /dev/disks/naa.5007116091c12199a2471bcc15bade11

The number of cylinders for this disk is set to 259777.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/disks/naa.5007116091c12199a2471bcc15bade11: 2136.7 GB, 2136746229760 bytes

255 heads, 63 sectors/track, 259777 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-259777, default 1): Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-259777, default 259777): Using default value 259777

Command (m for help): t

Selected partition 1

Hex code (type L to list codes): fb

Changed system type of partition 1 to fb (VMFS)

Command (m for help): x

Expert command (m for help): b

Partition number (1-4): 1

New beginning of data (63-4173317504, default 63): 128

Expert command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table

After that the datastore appeared and we were able to add the vm back into the inventory.

Reply
0 Kudos