VMware Cloud Community
duncanwannamake
Enthusiast
Enthusiast
Jump to solution

Formatting FC LUN from CLI problem, vmkfstools permission denied

I'm trying to automate the creation of a few VMFS volumes as part of a PXE kickstart install. I'm able to manually format the LUNs without any problems by using the VI client after a host has been installed. However, when I try to format the partition table from the command line I'm running into a roadblock. I know that the partition needs to be offset in a particular way with the correct flag (fb) to be recognized as a VMFS partition. Here is what I'm trying to do:

1. Wipe the LUN clean with `dd if=/dev/zero of=/dev/sdi bs=1m count=50` -- writing 50mb of zeros to the beginning of the drive

2. Dump a valid vmfs3 parition table back to the drive:

[root@esx01 ~]# sfdisk -f /dev/sdi < SharedTMPLs.part 
Checking that no-one is using this disk right now ...
OK

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdi1          0       -       0          0    0  Empty
/dev/sdi2          0       -       0          0    0  Empty
/dev/sdi3          0       -       0          0    0  Empty
/dev/sdi4          0       -       0          0    0  Empty

New situation:

   Device Boot    Start       End   #sectors  Id  System
/dev/sdi1           128  20964824   20964697  fb  VMware VMFS
/dev/sdi2             0         -          0   0  Empty
/dev/sdi3             0         -          0   0  Empty
/dev/sdi4             0         -          0   0  Empty
Warning: partition 1 does not end at a cylinder boundary
Successfully wrote the new partition table

3. Format the vmfs3 partition with vmkfstools:

[root@esx01 ~]# vmkfstools -C vmfs3 -S SharedTMPL -b 1m /vmfs/devices/disks/naa.60060160610022002622302cd8e4dd11
Creating vmfs3 file system on "naa.60060160610022002622302cd8e4dd11" with blockSize 1048576 and volume label "SharedTMPL".
Usage: vmkfstools -C vmfs3 /vmfs/devices/disks/vml... or,
       vmkfstools -C vmfs3 /vmfs/devices/disks/naa... or,
       vmkfstools -C vmfs3 /vmfs/devices/disks/mpx.vmhbaA:T:L:P
*Error: Permission denied*
[root@esx01 ~]# 

I'm running these commands as root. I have tried using vmkfstools -L release vmhba1, which seems to succeed but I still get the permission denied error.

Any ideas?

0 Kudos
1 Solution

Accepted Solutions
JaroF
Enthusiast
Enthusiast
Jump to solution

Sure.I actually know what you need to do. You have to add partition number at the end of the command. (naa.xxxx:1)

like that, and it will work:

vmkfstools -C vmfs3 -S SharedTMPL -b 1m /vmfs/devices/disks/naa.60060160610022002622302cd8e4dd11:1

View solution in original post

0 Kudos
2 Replies
JaroF
Enthusiast
Enthusiast
Jump to solution

Sure.I actually know what you need to do. You have to add partition number at the end of the command. (naa.xxxx:1)

like that, and it will work:

vmkfstools -C vmfs3 -S SharedTMPL -b 1m /vmfs/devices/disks/naa.60060160610022002622302cd8e4dd11:1

0 Kudos
duncanwannamake
Enthusiast
Enthusiast
Jump to solution

That worked! Thank you very much!

0 Kudos