VMware: Failed to get disk partition information in vSphere


image

Today I wanted to add a new iSCSI Lun to my vSphere Lab. I got the following error:

image

I had this error in the past, see my previous post: vmware-failed-to-get-disk-partition-information. I tried the solution described in my previous post but it didn’t  work in vSphere.

So I had to search for another solution. Luckily VMware released a KB document. See KB1008886. In this KB document VMware uses the command esxcfg-vmhbadevs. This command is replaced with a new command called esxcfg-scsidevs.

So I ran the esxcfg-scsidevs command on the service console:

image

After running the command, write down the following line: Console Device: /dev/sdc. Start Parted and walk through the following steps.

Note: don’t forget to change the /dev/sdb to the device you need to fix. In my case /dev/sdc.

To change the label and partitioning scheme:

Caution: This removes the pre-existing partition table, and any data on the volume is no longer be available. Ensure you are operating against the correct disk.

  1. Start parted to analyze the existing partition. Print the existing partition information, taking note of the Partition Table, size, and name. Ensure this is the data intended to be removed.
    Run the following commands:
    [root@esx ~]# parted /dev/sdb
    GNU Parted 1.8.1
    Using /dev/sdb
    Welcome to GNU Parted! Type ‘help’ to view a list of commands.
    (parted) print
    Disk geometry for /dev/sdb: 0.000-512.000 megabytes
    Disk label type: gpt
    Number  Start   End    Size   File system  Name                          Flags 
    1      17.4kB  134MB  134MB               Microsoft reserved partition  msftres
  2. Change the partition table (disklabel) type to msdos. This deletes the pre-existing partitions. Print the partition table again to observe the changes. Quit parted.
    Run the following commands:
    (parted) mklabel msdos
    (parted) print
    Disk geometry for /dev/sdb: 0.000-512.000 megabytes
    Disk label type: msdos
    Minor    Start       End     Type      Filesystem  Flags
    (parted) quit
  3. Return to the VI Client and use the Add Storage wizard again. Choose the same LUN, create a new partition, and format it with a VMFS Datastore as normal.

Source: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1008886

VMFS Volume Management Whitepaper


image

VMware released a new document about about VMFS volume management.

The guide explains the VMFS volume header metadata mechanism and describes the new 3.5 setting SCSI.CompareLUNNumber. A must read if you use third-party storage snapshot and replication technology.

Grab your copy here: vmfs_resig.pdf

Source:  http://frankdenneman.wordpress.com

VMware: Failed to get disk partition information


After creating a new IETD configuration at home, i wanted to add the new iSCSI LUN to my ESXi server. Everything went fine, the LUN was presented and the Add storage wizard has found the new LUN. But when i wanted to complete the wizard, the following error came up: 

image

In KB2240, you’ll find the following solution:

The easiest workaround is to use another disk for a datastore. If this is not possible, create the VMFS datastore manually. To do this:

  1. Use fdisk on the /dev/sd[a-z]* device. Create a partition with type 0xfb.
  2. Format the VMFS datastore using
    vmkfstools -C vmfs3 vmhbaI:T:L:P
    In this example, I corresponds to the initiator of the VMware host bus adapter, T corresponds to the target number of the disk, L is the LUN number, and P is the partition number of the newly created partition.

If you don’t know how to use fdisk, you can use this guide:

1. Log on to the console or use putty to connect to the ESX host remotely. If you have not created a user for yourself you will not be able to log in through putty.

2. SU to root. This must be done using the su – root command. If you do not use the – then you will not get root’s path and thus get error messages that say that commands cannot be found.

3. Run fdisk -l. This will give you a list of all of your current partitions. This is important because they are numbered. If you are using SCSI you should see that all partitions start with /dev/sda# where # is a number from 1 to what ever. Remember this list of number as you are going to be adding at least one more and will have to refer to the new partition by it’s number.

4. Run fdisk /dev/sda. This will allow you to create a partition on the the first drive. If you have more than one SCSI drive (usually the case with more than one RAID container) then you will have to type the letter value for the device you wish to create the partition on (sdb, sdc, and so on).

5. You are now in the fdisk program. If you get confused type "m" for menu. This will list all of your options. There are a lot of them. You will be ignoring most of them.

6. Type "n". This will create a new partition. It will ask you for the starting cylinder. Unless you have a very good reason hit "enter" for default. The program will now offer you a second option that says ending cylinder. If you press enter you will select the rest of the space. In most cases this is what you want.

7. Once you have selected start and end cylinder you should get a success message. Now you must set the partition type or it’s ID. This is option "t" on the menu.

8. Type "t". It will ask you for partition number. This is where that first fdisk is useful. You need to know what the new partition number is. It will be one more than the last number on fdisk. Type this number in.

9. You will now be prompted for the hex code for the partition type. You can also type "L" for a list of codes. The code you want is "fb". So type "fb" in the space. This will return that the partition has been changed to fb (unknown). That is what you want.

10. Now that you have configured everything you want to save it. To do so choose the "w" option to write the table to disk and exit.

11. Because the drive is being used by the console OS you will probably get an error that says "WARNING: Re-reading the partition table failed with error 16: device or resource busy." This is normal. You will need to reboot.

12. To reboot the server type "reboot" at the prompt.

13. Once you have rebooted you can now format the partition VMFS. DO NOT do this from the GUI. You must once again log into the console or remote in through putty.

14. Once you have su’d to root you must type in "vmkfstool -C vmfs3 /vmfs/device/disks/vmhba0:0:0:#" Were # is the number of the new partition. You shoulder now get a "successfully created new volume" message. If you get an error you probably chose the wrong partition. Do an fdisk – l and choose the number with the "unknown" partition type. Note: IF you have more than one SCSI disk or more than one container the first 0 may need to be a 1 as well.

15. Go to the GUI and in configuration/storage select refresh. You should now see your new VMFS volume.

Source: http://communities.vmware.com/docs/DOC-1382