Monday, June 1, 2009

Adding Disk - Storage To VMWare ESX

In VMWare ESX, in order to be able to use a disk, this should be first in VMWare's own file system format, which is "vmfs3", other will it will not recognize the disk and, you wont be able for example store you virtual machines there.

This is quite is one a big diference between VMWare ESX and the VMWare desktop, version.
So in the next few line I'm going to show how prepare and add a disk to VMWare ESX.

Step #1 Run fdisk -l and find the disk that you want to format with VMFS3.

$ su

# fdisk -l | grep Disk
Disk /dev/sda: 32.2 GB, 32212254720 bytes
Disk /dev/sdb: 53.6 GB, 53687091200 bytes
Disk /dev/sdc: 32.2 GB, 32212254720 bytes
Disk /dev/sdd: 53.6 GB, 53687091200 bytes
Disk /dev/sde: 32.2 GB, 32212254720 bytes
Disk /dev/sdf: 10.7 GB, 10737418240 bytes
Disk /dev/sdg: 32.2 GB, 32212254720 bytes
Disk /dev/sdh: 32.2 GB, 32212254720 bytes
Disk /dev/sdi: 32.2 GB, 32212254720 bytes
Disk /dev/sdj: 21.4 GB, 21474836480 bytes
Disk /dev/sdk: 214.7 GB, 214748364800 bytes Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes


Note: The /dev/sdk is the one I will be adding to VMWare ESX


# fdisk -l /dev/sdk

Disk /dev/sdk: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System


Has you can see, sdk doesen't have any partitions,
so we must create one to later on format in the "vmf3" format.

Step #2 Creating a Partition (to format later on in "vmf3")

Note: the partition in this examples, ocupies all of the disk.

First we will create the partition (n) then change the type (t) to fb. Then (w) save the changes. Check fdisk /dev/sda again and list partitions (p) - it should list as fb.


# fdisk /dev/sdk

The number of cylinders for this disk is set to 26108.
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): n
Command action
e extended
p primary partition (1-4)
p

Partition number (1-4): 1
First cylinder (1-26108, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-26108, default 26108):
Using default value 26108

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fb
Changed system type of partition 1 to fb (Unknown)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


Note: I tried to create an extended partition, but it didn't work, fdisk didn't let met change the type to "fb".


Step #3 Then run esxcfg-vmhbadevs -m to see which vmhba devices is mapped to the partion in step #1

# esxcfg-vmhbadevs -m

vmhba1:0:4:1 /dev/sdd1 4866618b-6a9fda41-fba6-00565aa64ffa
vmhba1:0:1:1 /dev/sda1 486660ea-fe9d98aa-8010-00565aa64ffa
vmhba1:0:3:1 /dev/sdc1 48666166-5068fbcd-dfcd-00565aa64ffa
vmhba1:0:2:1 /dev/sdb1 48666146-f15b8e96-2c49-00565aa64ffa
vmhba1:0:6:1 /dev/sdf1 486661b9-4da3f066-3017-00565aa64ffa
vmhba1:0:5:1 /dev/sde1 486661a4-9d3c1b7d-3ec6-00565aa64ffa
vmhba1:0:8:1 /dev/sdh1 486661e5-84ce84f3-acd2-00565aa64ffa
vmhba0:0:0:3 /dev/cciss/c0d0p3 48666bff-9ed64a25-636c-00215aa65f04
vmhba1:0:10:1 /dev/sdj1 4866620f-939412da-7ede-00565aa64ffa
vmhba1:0:7:1 /dev/sdg1 486661d0-debeffc1-9e08-00565aa64ffa
vmhba1:0:9:1 /dev/sdi1 486661f9-4cff8fab-57a6-00565aa64ffa


Because it has no partition, starting with "sdk" (ex: vmhba1:0:9:1 /dev/sdk1) , which is the disks name, let's try to list only the disks to see if VMWare ESX detects it,

# esxcfg-vmhbadevs
vmhba0:0:0 /dev/cciss/c0d0
vmhba1:0:1 /dev/sda
vmhba1:0:2 /dev/sdb
vmhba1:0:3 /dev/sdc
vmhba1:0:4 /dev/sdd
vmhba1:0:5 /dev/sde
vmhba1:0:6 /dev/sdf
vmhba1:0:7 /dev/sdg
vmhba1:0:8 /dev/sdh
vmhba1:0:9 /dev/sdi
vmhba1:0:10 /dev/sdj
vmhba1:0:11 /dev/sdk

The disk is the but there's no partition, we will create it later on.


Step #4 Formating the Previously Created Partition in "vmfs3"

Basicly we will run vmkfstools -C vmfs3 -S "volume name" vmhba#_from_step#3


In the step before we noted that VMWare detected sdk and that it had the id "vmhba1:0:11", but there was no partition, and that by comparing the results from "esxcfg-vmhbadevs -m" (list partitions) and "esxcfg-vmhbadevs" (list disks), in the previous step the id of the partition sdk1 should be "vmhba1:0:11:1", so this is the id we will be using in the format command below.

# vmkfstools -C vmfs3 -S "ESX03" vmhba1:0:11:1

Creating vmfs3 file system on "vmhba1:0:11:1" with blockSize 1048576 and volume label "ESX03".
Successfully created new volume: 4a23df5c-41c0dac6-a39f-00215aa64ffa


Now you have the disk ready ready to add to VMWare ESX,

Step #5 Add the storage to a Blade (fisical PC) in VMWARE ESX,

Just click on one blade "Configuration | Add Storage",
and selectct "Disk/Lun", and Next in following windows.
















Note: I think if you add the disk to one blade it, will be added to all the other blades.
I tried to add to a second blade and it didn't allowed me to do that.

Step #7 Create Virtual Machines, ande select the DataStorage previously created

3 comments:

Anonymous said...

Can anyone recommend the robust Managed Service utility for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central desktop management
? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!

Unknown said...
This comment has been removed by a blog administrator.
Jago83 said...
This comment has been removed by the author.