VMware Cloud Community
windvally
Contributor
Contributor

How to add storage to datastore?

I have added an iscsi LUN to ESXi host. I can see the device had been found . but I don't know how to add the storage into Datastore with ESXcli.

vi-admin@localhost:~[192.168.0.200]> esxcli storage core device list

naa.600140597d318d3dc4dfd3d6ad84f3d8

   Display Name: SYNOLOGY iSCSI Disk (naa.600140597d318d3dc4dfd3d6ad84f3d8)

   Has Settable Display Name: true

   Size: 33792

   Device Type: Direct-Access

   Multipath Plugin: NMP

   Devfs Path: /vmfs/devices/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8

   Vendor: SYNOLOGY

   Model: iSCSI Storage

   Revision: 3.1

   SCSI Level: 5

   Is Pseudo: false

   Status: degraded

   Is RDM Capable: true

   Is Local: false

   Is Removable: false

   Is SSD: false

   Is Offline: false

   Is Perennially Reserved: false

   Queue Full Sample Size: 0

   Queue Full Threshold: 0

   Thin Provisioning Status: unknown

   Attached Filters:

   VAAI Status: supported

   Other UIDs: vml.0200000000600140597d318d3dc4dfd3d6ad84f3d8695343534920

   Is Local SAS Device: false

   Is Boot USB Device: false

vi-admin@localhost:~[192.168.0.200]>

0 Kudos
8 Replies
julienvarela
Commander
Commander

Hi,

Did you check here : http://failprevent.wordpress.com/2012/02/17/esx-cli-create-vmfs-and-datastore-on-backend-storage/

1- Create a Partition Table

~ # fdisk /vmfs/devices/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8

m: menu
p: print current partition table
-> It should be empty
n: new partition
-> follow wizzard
t: set partition type to VMFS
-> fb
w: write partition table & exit

2 - Create a VMFS datastore

~ # vmkfstools -C vmfs5 -S datastorename /vmfs/devices/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8\:1

I hope it help.

Regards,

Julien.

Regards, J.Varela http://vthink.fr
windvally
Contributor
Contributor

/dev/disks # fdisk /dev/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8

***

*** The fdisk command is deprecated: fdisk does not handle GPT partitions.  Please use partedUtil

***

The number of cylinders for this disk is set to 4307.

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): p

Disk /dev/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8: 35.4 GB, 35433480192 bytes

255 heads, 63 sectors/track, 4307 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

                                           Device Boot      Start         End      Blocks  Id System

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-4307, default 1): Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-4307, default 4307): Using default value 4307

Command (m for help): t

Selected partition 1

Hex code (type L to list codes): fb

Changed system type of partition 1 to fb (VMFS)

Command (m for help): w

The partition table has been altered.

Calling ioctl() to re-read partition table

/dev/disks #

but i can't  creat datastore

/dev/disks # ls

mpx.vmhba1:C0:T0:L0

mpx.vmhba1:C0:T0:L0:1

mpx.vmhba1:C0:T0:L0:2

mpx.vmhba1:C0:T0:L0:3

mpx.vmhba1:C0:T0:L0:5

mpx.vmhba1:C0:T0:L0:6

mpx.vmhba1:C0:T0:L0:7

mpx.vmhba1:C0:T0:L0:8

naa.600140529e671bcd450dd34e4d931fdf

naa.600140529e671bcd450dd34e4d931fdf:1

naa.600140597d318d3dc4dfd3d6ad84f3d8

vml.0000000000766d686261313a303a30

vml.0000000000766d686261313a303a30:1

vml.0000000000766d686261313a303a30:2

vml.0000000000766d686261313a303a30:3

vml.0000000000766d686261313a303a30:5

vml.0000000000766d686261313a303a30:6

vml.0000000000766d686261313a303a30:7

vml.0000000000766d686261313a303a30:8

vml.0200000000600140529e671bcd450dd34e4d931fdf695343534920

vml.0200000000600140529e671bcd450dd34e4d931fdf695343534920:1

vml.0200000000600140597d318d3dc4dfd3d6ad84f3d8695343534920

vml.0200010000600140529e671bcd450dd34e4d931fdf695343534920

vml.0200010000600140529e671bcd450dd34e4d931fdf695343534920:1

/dev/disks # vmkfstools -C vmfs5  -S test33 /vmfs/devices/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8

create fs deviceName:'/vmfs/devices/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8', fsShortName:'vmfs5', fsName:'test33'

deviceFullPath:/dev/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8 deviceFile:naa.600140597d318d3dc4dfd3d6ad84f3d8

VMFS5 file system creation is deprecated on a BIOS/MBR partition on device 'naa.600140597d318d3dc4dfd3d6ad84f3d8'

Checking if remote hosts are using this device as a valid file system. This may take a few seconds...

Creating vmfs5 file system on "naa.600140597d318d3dc4dfd3d6ad84f3d8" with blockSize 1048576 and volume label "test33".

/vmfs/devices/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8: Permission denied.  (Have you set the partition type to 0xfb?)

Error: Permission denied

/dev/disks #

0 Kudos
windvally
Contributor
Contributor

Thanks, But the error is like before.

0 Kudos
julienvarela
Commander
Commander

Ok, fdisk is not used on esxi5 , you will need to use partedutil.

Check here virtuallyGhetto: How to Format and Create VMFS5 Volume using the CLI in ESXi 5

It should be ok.

Regards,

Julien.

Regards, J.Varela http://vthink.fr
0 Kudos
windvally
Contributor
Contributor

i can't open link for virtuallyGhetto: How to Format and Create VMFS5 Volume using the CLI in ESXi 5

/dev/disks # partedUtil setptbl naa.600140597d318d3dc4dfd3d6ad84f3d8 gpt "1  128 4307 AA31E02A400F11DB9590000C2911D1B8 0"

gpt

0 0 0 0

1 128 4307 AA31E02A400F11DB9590000C2911D1B8 0

/dev/disks # ls

mpx.vmhba1:C0:T0:L0                                           vml.0000000000766d686261313a303a30:1

mpx.vmhba1:C0:T0:L0:1                                         vml.0000000000766d686261313a303a30:2

mpx.vmhba1:C0:T0:L0:2                                         vml.0000000000766d686261313a303a30:3

mpx.vmhba1:C0:T0:L0:3                                         vml.0000000000766d686261313a303a30:5

mpx.vmhba1:C0:T0:L0:5                                         vml.0000000000766d686261313a303a30:6

mpx.vmhba1:C0:T0:L0:6                                         vml.0000000000766d686261313a303a30:7

mpx.vmhba1:C0:T0:L0:7                                         vml.0000000000766d686261313a303a30:8

mpx.vmhba1:C0:T0:L0:8                                         vml.0200000000600140529e671bcd450dd34e4d931fdf695343534920

naa.600140529e671bcd450dd34e4d931fdf                          vml.0200000000600140529e671bcd450dd34e4d931fdf695343534920:1

naa.600140529e671bcd450dd34e4d931fdf:1                        vml.0200000000600140597d318d3dc4dfd3d6ad84f3d8695343534920

naa.600140597d318d3dc4dfd3d6ad84f3d8                          vml.0200000000600140597d318d3dc4dfd3d6ad84f3d8695343534920:1

naa.600140597d318d3dc4dfd3d6ad84f3d8:1                        vml.0200010000600140529e671bcd450dd34e4d931fdf695343534920

vml.0000000000766d686261313a303a30                            vml.0200010000600140529e671bcd450dd34e4d931fdf695343534920:1

/dev/disks #

/dev/disks # vmkfstools -C vmfs5 -S my33 /vmfs/devices/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8:1

create fs deviceName:'/vmfs/devices/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8:1', fsShortName:'vmfs5', fsName:'my33'

deviceFullPath:/dev/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8:1 deviceFile:naa.600140597d318d3dc4dfd3d6ad84f3d8:1

Checking if remote hosts are using this device as a valid file system. This may take a few seconds...

Creating vmfs5 file system on "naa.600140597d318d3dc4dfd3d6ad84f3d8:1" with blockSize 1048576 and volume label "my33".

Usage: vmkfstools -C [vmfs3|vmfs5] /vmfs/devices/disks/vml... or,

       vmkfstools -C [vmfs3|vmfs5] /vmfs/devices/disks/naa... or,

       vmkfstools -C [vmfs3|vmfs5] /vmfs/devices/disks/mpx.vmhbaA:T:L:P

Error: No space left on device

/dev/disks #

0 Kudos
windvally
Contributor
Contributor

/dev/disks # partedUtil getptbl naa.600140597d318d3dc4dfd3d6ad84f3d8

gpt

4307 255 63 69206016

1 128 4307 AA31E02A400F11DB9590000C2911D1B8 vmfs 0

/dev/disks # partedUtil getptbl naa.600140597d318d3dc4dfd3d6ad84f3d8:1

unknown

0 255 63 4180

/dev/disks #

0 Kudos
windvally
Contributor
Contributor

/dev/disks # partedUtil delete naa.600140597d318d3dc4dfd3d6ad84f3d8 1

/dev/disks #

/dev/disks # partedUtil setptbl naa.600140597d318d3dc4dfd3d6ad84f3d8 gpt "1 128 66666666 AA31E02A400F11D

B9590000C2911D1B8 0"

gpt

0 0 0 0

1 128 66666666 AA31E02A400F11DB9590000C2911D1B8 0

/dev/disks #

/dev/disks #  vmkfstools -C vmfs5 -S my33 /vmfs/devices/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8:1

create fs deviceName:'/vmfs/devices/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8:1', fsShortName:'vmfs5', fsName:'my33'

deviceFullPath:/dev/disks/naa.600140597d318d3dc4dfd3d6ad84f3d8:1 deviceFile:naa.600140597d318d3dc4dfd3d6ad84f3d8:1

Checking if remote hosts are using this device as a valid file system. This may take a few seconds...

Creating vmfs5 file system on "naa.600140597d318d3dc4dfd3d6ad84f3d8:1" with blockSize 1048576 and volume label "my33".

Successfully created new volume: 52044a53-ccc19ce3-91be-18a90570b1e4

/dev/disks #

0 Kudos
julienvarela
Commander
Commander

/dev/disks # partedUtil setptbl naa.600140597d318d3dc4dfd3d6ad84f3d8 gpt "1 128 66666666 AA31E02A400F11D

B9590000C2911D1B8 0"

Hi,

1 128 66666666 AA31E02A400F11DB9590000C2911D1B8 0


it should be 2048 instead of 128  " This will always be 2048 for 1MB alignment for VMFS5"  and the value 666666666 should be the end sector.

Regards,

Julien.

Regards, J.Varela http://vthink.fr
0 Kudos