Fix error when adding datastore in VMware ESXi

Posted In Virtualization - By Tum. On Thursday, July 26th, 2012 With 0 Comments

เมื่อทำการ add datastore เข้าไปยัง VMware ESX/ESXi ด้วย Add Storage wizard แล้วเกิด error ดังข้างล่าง

An error occurred during host configuration. Call “HostDatastoreSystem.QueryVmfsDatastoreCreateOptions” for object “ha-datastoresystem” on ESXi “xxx.xxx.xxx.xx″ failed. An internal error occurred in the vsphere client.

VMware datastore

ปัญหานี้อาจเกิดจาก

  1. ขนาดของของ LUN มีขนาดใหญ่กว่า 2TB – 512 bytes (vSphere 4)
  2. LUN นี้เคยถูกใช้แบบ RDM (Raw Device Mapping)
  3. LUN มี GPT partition ที่ไม่สามารถลบออกได้

ปัญหาโดยส่วนใหญ่เกิดจากการนำ LUN กลับมาใช้ใหม่ (ข้อ 2-3) แล้วภายในมีการ set type ของ partition เป็น bsd, dvh, gpt, loop, mac, pc98 หรือ sun จึงทำให้ไม่สามารถ create datastore ได้ แต่ถ้าเป็น type ของ partition เป็น msdos หรือไม่มี partition เลยจะสามารถสร้างได้ ดังนั้นถ้าหากเกิดปัญหานี้ขึ้นจึงจำเป้นต้องลบ partition table ของ LUN ที่มีปัญหานั้นทิ้ง

วิธีการแก้ไข

ให้ตรวจสอบ device ทั้งหมดที่มีว่า device ชื่ออะไรบ้างเพื่อนำไปตรวจสอบว่าเป็น device ที่มีปัญหาหรือไม่

ให้ใช้คำสั่ง fdisk เพื่อตรวจสอบหาว่า device ไหนที่มีปัญหา โดยใช้คำสั่ง

เมื่อ DISK_NAME คือ ชื่อของ disk device
ตัวอย่างเช่น

จากตัวอย่างจะเห็นว่า device นี้มี GPT partitions อยู่ซึ่ง VMware ไม่สามารถนำ device นี้มาเป็น datastore ได้ ดังนั้นเราจึงต้องทำการลบ partition table ทิ้ง ด้วยคำสั่งด้านล่าง เพื่อให้ VMware คิดว่าเป็น disk เปล่า

ตัวอย่างเช่น

สำหรับ GPT partitions จะมี backup partition table อยู่ที่ 34 sectors ท้ายสุดของ disk ด้วยดังนั้นจะต้องลบออกด้วยคำสั่งคล้ายด้านบนแต่จะต้องหา จุดเริ่มต้นของ 34 sector ท้ายสุดของ disk ก่อน ด้วยวิธีคำนวนดังนี้

(SizeInBytes / 512) – 34 = SeekOffset

จากนั้นจะได้ จุดเริ่มต้นของ 34 sector ท้ายสุดของ disk ก็ให้มาแทนค่าด้วย SeekOffset ในคำสั่งด้านล่าง

จากตัวอย่างด้านบนจะเห็นว่า Disk นี้มีขนาด 8225280 bytes ดังนั้นจะคำนวนหา SeekOffset ได้ดังนี้

(8225280 / 512) – 34 = 16031

คำสั่งลบ backup partition table ของ GPT partitions

คำค้นยอดนิยม: FixerrorwhenaddingdatastoreinVMwareESXi-EzyLinux

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

*