Skip to content
www.mytechnote.ru
Menu
  • Administration
    • Scripts
  • Equipment
    • Reviews
    • Instructions
  • Other
  • English
    • English
    • Русский
Menu

Restoring a datastore in vCenter: A Step-by-Step Guide

Greetings! If you’ve ever dealt with removing a datastore in vCenter, you know the challenge: the partition table on the linked LUN gets wiped out, often leading to the fear of data loss when trying to reconnect the datastore. In this guide, we’ll walk you through a method to potentially restore a partition table without risking your valuable data.

Important Note: While we provide these steps to help you, please remember that handling partitions requires care. Mistakes could result in data loss not only on the target datastore but also on other storage. Proceed with caution.

  1. Identifying the Datastore Path

Start by identifying the path to your datastore. Open vCenter’s web interface, head to the “Host Configure” tab, and select “Storage Devices.”

Restoring a datastore in vCenter:  A Step-by-Step Guide - checkout datstore path

In our example, the path is: /vmfs/devices/disks/naa.60002ac0000000000000003e00009b09

  1. Pinpointing First and Last Blocks

In an SSH session, check current partition table:

partedUtil getptbl /vmfs/devices/disks/naa.60002ac0000000000000003e00009b09

Restoring a datastore in vCenter:  A Step-by-Step Guide - partition table

Let’s locate the first and last blocks of the partition.

To find the first block, use this command:

offset="128 2048"; for dev in `esxcfg-scsidevs -l | grep "Console Device:" | awk {'print $3'} | grep 60002ac0000000000000003e00009b09`; 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

This command should display information about the partition, including its name and offset.

Restoring a datastore in vCenter:  A Step-by-Step Guide - determining the first block

Next, find the last block:

partedUtil getUsableSectors /vmfs/devices/disks/naa.60002ac0000000000000003e00009b09

Restoring a datastore in vCenter:  A Step-by-Step Guide - determining the last block

  1. Handling Unknown Partition Table

If you encounter an “unknown partition table” message, attempt this command:

partedUtil mklabel /vmfs/devices/disks/naa.60002ac0000000000000003e00009b09 gpt
  1. Validating VMFS Partition GUID

It’s often AA31E02A400F11DB9590000C2911D1B8, but you can confirm using:

partedUtil showGuids

Restoring a datastore in vCenter:  A Step-by-Step Guide - guids table

  1. Attempting Partition Restoration

With this information:

LUN ID: naa.60002ac0000000000000003e00009b09

First block: 2048

Last block: 12884901854

Partition GUID: AA31E02A400F11DB9590000C2911D1B8

Let’s create a partition marker:

partedUtil setptbl /vmfs/devices/disks/naa.60002ac0000000000000003e00009b09 gpt "1 2048 12884901854 AA31E02A400F11DB9590000C2911D1B8 0"

Restoring a datastore in vCenter:  A Step-by-Step Guide - creating a partition

Confirm the table:

partedUtil getptbl /vmfs/devices/disks/naa.60002ac0000000000000003e00009b09

Restoring a datastore in vCenter:  A Step-by-Step Guide - check the partitions

  1. Mounting the Datastore

Now, attempt to mount the datastore:

vmkfstools -V
esxcli storage core adapter rescan –all

The datastore should now be visible in the vCenter web interface. If it’s unmounted, proceed to remount it.

Restoring a datastore in vCenter:  A Step-by-Step Guide - datastore is visible now

And the data is presented on the datastore.

Restoring a datastore in vCenter:  A Step-by-Step Guide - data is there

Posted on 25.08.202330.05.2024 by sanglyb

Post navigation

← Managing local ESXi users with PowerCli
How to Add Certificate Chains for SSL Certificates pkcs12 (p12, pfx) Using OpenSSL, how to convert them →

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Подписывайтесь

Youtube
vk
telegram
github
twitter
rss
  • Форум
  • Об авторе
  • Поддержать автора

Популярные записи

Новые записи

  • How to Extend an LVM Partition in Linux
  • SCCM Reporting Errors After Migrating from SQL Server 2016 to 2019
  • Problem Using PassFiltEx on Older CPUs
  • How to remove attachments from old calendar events in Exchange using a script
  • How to download and install Office 2024 LTSC

Архивы

  • 2026 (3)
  • 2025 (5)
  • 2024 (7)
  • 2023 (30)
  • 2022 (4)
  • 2020 (17)
  • 2017 (82)
  • 2016 (5)
© 2015-2026 www.mytechnote.ru
Использование материалов сайта возможно только с разрешения владельца или обязательна индексируемая, прямая, передающая вес ссылка на материал.