VMware Cloud Community
arturka
Expert
Expert

How to add new LUN and create VMFS via command line

Hello all

I've to add new LUN to my 4 ESX 3.5.4 servers and create VMFS on it. It

has to be done by command line (I've a problem with this task using VC

- host time out )

For the moment I've 12 LUN's with VMFS and about 18 without (seems to

like are mapped as RAW device for MS cluster - but I'm not sure)

******************************************************************************************************

  1. /usr/sbin/esxcfg-vmhbadevs -m

vmhba1:0:5:1 1 49902d06-5e5b2170-fe67-0015178f1ee1

vmhba1:0:6:1 1 49c0f89d-0810cbae-2594-00221983a9ad

vmhba1:0:1:1 1 492d5d48-90fc1a3e-3643-0015178f1ee1

vmhba1:0:4:1 1 49902cd3-7238c733-2103-0015178f1ee1

vmhba1:0:27:1 1 4aae3c3a-44536222-e24b-001b213f2250

vmhba1:0:26:1 1 4aae3532-334c2479-ebea-001b213f2250

vmhba1:0:25:1 1 4a8cfdc2-e0bd2c11-e980-0015178f1ee1

vmhba1:0:23:1 1 4a793d17-dd4d01e8-b173-00221983a9ad

vmhba1:1:0:1 1 48f46f4f-dda28c03-b7ec-002219830f80

vmhba3:0:0:3 /dev/sdm3 4a364614-60dabfa0-6a10-002219c9f97b

vmhba1:0:2:1 1 4946681c-f19dce40-0b53-0015178f1ee1

vmhba1:0:22:1 1 4a25fa96-da752a49-461b-00221983a9ad

vmhba1:0:3:1 1 4979968f-a3bffa2d-8623-00221983a9ad

******************************************************************************************************

and about 18 without (seems to

like are mapped as RAW device for MS cluster - but I'm not sure)

******************************************************************************************************

/]# /usr/sbin/esxcfg-mpath -l |grep -i disk

Disk vmhba1:0:1 (512000MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:26 (512000MB) has 2 paths and policy of Most Recently Used

Disk vmhba1:0:10 (51200MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:29 (512000MB) has 2 paths and policy of Most Recently Used

Disk vmhba1:0:27 (512000MB) has 2 paths and policy of Most Recently Used

Disk vmhba1:0:30 (512000MB) has 2 paths and policy of Most Recently Used

Disk vmhba1:1:0 (512000MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:11 (30720MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:12 (30720MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:4 (512000MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:24 (51200MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:13 (1024MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:21 (1024MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:5 (512000MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:14 (153600MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:7 (30720MB) has 4 paths and policy of Most Recently Used

Disk vmhba3:0:0 /dev/sdm (571136MB) has 1 paths and policy of Fixed

Disk vmhba1:0:15 (30720MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:8 (30720MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:25 (512000MB) has 2 paths and policy of Most Recently Used

Disk vmhba1:0:9 (102400MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:28 (512000MB) has 2 paths and policy of Most Recently Used

Disk vmhba1:0:2 (512000MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:16 (30720MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:22 (512000MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:17 (30720MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:3 (512000MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:18 (51200MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:6 (512000MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:19 (51200MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:23 (512000MB) has 4 paths and policy of Most Recently Used

Disk vmhba1:0:20 (1024MB) has 4 paths and policy of Most Recently Used

******************************************************************************************************

I know that esxcfg-rescan has to be used for scanning HBA and vmkfstools has to be used for creating file sysytem.

My question is how can I idetified which LUN is the new one (after scanning) and how can I idetified which LUN is already used by VM's, to avoid situation LUN reformating by VMFS ?

Thank you in advance

Artur

VCDX77 My blog - http://vmwaremine.com
Tags (3)
0 Kudos
15 Replies
depping
Leadership
Leadership

fdisk -l

might give you a hint?

Duncan

VMware Communities User Moderator | VCP | VCDX

-


Blogging:

Twitter: (*NEW*)

Available Soon: vSphere Quick Start Guide ()

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
arturka
Expert
Expert

Hi

this is output - is showingVMhost local storage configuration

**************************************************************

]# /sbin/fdisk -l

Disk /dev/sdm: 598.8 GB, 598879502336 bytes

255 heads, 63 sectors/track, 72809 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sdm1 * 1 65 522081 83 Linux

/dev/sdm2 66 2105 16386300 83 Linux

/dev/sdm3 2106 71241 555334920 fb Unknown

/dev/sdm4 71242 72809 12594960 f Win95 Ext'd (LBA)

/dev/sdm5 71242 71763 4192933+ 83 Linux

/dev/sdm6 71764 72273 4096543+ 83 Linux

/dev/sdm7 72274 72534 2096451 82 Linux swap

/dev/sdm8 72535 72795 2096451 83 Linux

/dev/sdm9 72796 72809 112423+ fc Unknown

**************************************************************

VCDX77 My blog - http://vmwaremine.com
0 Kudos
naveenvm
Enthusiast
Enthusiast

Hi, u can follow this procedure -

Use this command to list all devices, mapped to ESX (iscsi, fc).

esxcfg-vmhbadevs -l

You can use the command esxcfg-vmhbadevs -m to see the relationship between vmhba and devnames. This produces an output like so:

vmhba0:0:0:8 /dev/sda8 443e567e-7c606397-0977-00065b0f7e2d

Enter fdisk /dev/sd<x> where <x> is the device suffix.

Determine if any VMware VMFS partitions already exist. VMware VMFS partitions are

identified by a partition system ID of fb.

Also, you can recheck in GUI, in ADD STORAGE section, all luns displayed there are non vmfs(may include RDM, if any)

Finally use this command to create vmfs partition i.e. datastore

"vmkfstools -C vmfs3 -S storage vmhba0:0:0"

NUTZ

VCP 3.5

(Preparing for VCP 4)

NUTZ VCP 3.5 (Preparing for VCP 4)
0 Kudos
arturka
Expert
Expert

your procedure will wroks in case of adding local storage and creat VMFS on it. But I have to add LUN on SAN storage

my output for command

/usr/sbin/esxcfg-vmhbadevs -m

vmhba1:2:22:1 1 4a25fa96-da752a49-461b-00221983a9ad

vmhba1:2:6:1 1 49c0f89d-0810cbae-2594-00221983a9ad

vmhba1:2:4:1 1 49902cd3-7238c733-2103-0015178f1ee1

vmhba1:2:3:1 1 4979968f-a3bffa2d-8623-00221983a9ad

vmhba1:2:2:1 1 4946681c-f19dce40-0b53-0015178f1ee1

vmhba1:2:1:1 1 492d5d48-90fc1a3e-3643-0015178f1ee1

vmhba1:2:27:1 1 4aae3c3a-44536222-e24b-001b213f2250

vmhba1:2:26:1 1 4aae3532-334c2479-ebea-001b213f2250

vmhba1:2:25:1 1 4a8cfdc2-e0bd2c11-e980-0015178f1ee1

vmhba1:2:23:1 1 4a793d17-dd4d01e8-b173-00221983a9ad

vmhba1:2:5:1 1 49902d06-5e5b2170-fe67-0015178f1ee1

vmhba1:2:0:1 1 48f46f4f-dda28c03-b7ec-002219830f80

vmhba0:0:0:11 /dev/sda11 4a9f9d52-23475f5d-f82c-0024e83877ae

VCDX77 My blog - http://vmwaremine.com
0 Kudos
kjb007
Immortal
Immortal

If you are having an issue with connecting to vCenter with the command line, have you tried to connect directly to ESX server using the vi client? That would be the better option. Doing this command line, you also want to make sure you get the fdisk start block correct, as well, which the vi client does for you automatically.

-KjB

VMware vExpert

Don't forget to leave points for helpful/correct posts.

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
0 Kudos
arturka
Expert
Expert

I'd tried already to connect directly to ESX HOST via VIclient, but error is this same like on VC (see screenshot)

While I'm clicking on Add Storage after 30 seconds message appearing on screen.

Have you any ideas what can be a root cause of this message ?

VCDX77 My blog - http://vmwaremine.com
0 Kudos
kjb007
Immortal
Immortal

What ESX update are you running? How busy is the ESX host? Have you verified that the networking is correct?, gateways and such on the ESX machine?

-KjB

VMware vExpert

Don't forget to leave points for helpful/correct posts.

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
0 Kudos
arturka
Expert
Expert

ESX HOST are 3.5 U4

yes, CPU utilization is about 25% on all of them, any other set in configuration such as networking, cluster, Resource Pools can be changed and applie, like for me it's no a problem with ESX hosts

It can be a peoblem with VC because VC is in North America but ESX HOSTS are in EU. Anyway should be a problem while I'm trying to add new storage connected directly to ESX HOST. A month ago it was working fine without any problems.

Artur

VCDX77 My blog - http://vmwaremine.com
0 Kudos
kjb007
Immortal
Immortal

I don't suppose you've updated the ESX hosts recently, and haven't updated your vi client?

-KjB

VMware vExpert

Don't forget to leave points for helpful/correct posts.

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Rumple
Virtuoso
Virtuoso

Here is a question though, does creating the vmfs volumes through vmkfstool still create then unaligned? It was recommended in ESX 3.0 that you always use VC to create the volumes otherwise they were not aligned on the boundary...

Edit..oops...question was already sort of asked, when refering making sure you get starting block correct.

0 Kudos
arturka
Expert
Expert

I've got very old VI client version 2.5.0 :/, but after update error is this same.

Any ideas ?

Artur

VCDX77 My blog - http://vmwaremine.com
0 Kudos
kjb007
Immortal
Immortal

After this error occurs, have you looked at the vi client logs to see if you can get more info? We're getting off on a tangent here. You can create the vmfs from command line using fdisk, and vmkfstools if you'd rather just do that instead.

-KjB

VMware vExpert

Don't forget to leave points for helpful/correct posts.

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
0 Kudos
arturka
Expert
Expert

I know that I cna create VMFS via cmd line, but I don't know how can I identified new LUN, because some of the LUN are used by MS clusters like RAW devices and some of them are used by VMFS.

Maybe you know how can I idetified which LUN I can formated ?

Artur

VCDX77 My blog - http://vmwaremine.com
0 Kudos
arturka
Expert
Expert

Problem SOLVED Smiley Happy thanks to my friend Ionut.

So, in case of problem mentioned above on parameter in VI vlient has to be changed " Remote command timeout" (see printscreen) Default is set to 30 second, you have to change it e.g 600 second, and error message doesn't appear any more.

Artur

VCDX77 My blog - http://vmwaremine.com
0 Kudos
arturka
Expert
Expert

question answered

VCDX77 My blog - http://vmwaremine.com
0 Kudos