Change blocksize of local VMFS

During install vSphere now creates a VMFS partition by default on the local storage on which the service console partitions will be installed. When you want to use this partition to store your VMs on (non-VMotionable) there is no problem, just point to this datastore and use it. In my homelab the ESX hosts have very cheap but big local disks. With only 8GB or 10GB occupied by ESX, I had around 600GB left on that local disk. I wanted to use it to store some large VMDKS on it, but couldn’t because of the 1MB blocksize which doesn’t allow me to make disks bigger then 256GB. Since the COS is running on the VMFS you can’t just reformat it.

After automated install with kickstart, I found that my original /dev/sda was now called /dev/sdd and would hold the /boot, vmkcore and the vmfs volume. The partitions inside the vmfs volume where on /dev/sde. There was still a very big space on /dev/sdd on which I wanted to create that extra vmfs volume. But no matter what I tried, I couldn’t make it work. The VI Client didnot see an empty space on which it could build a datastore. Trying to add a partition through the COS using fdisk gave write errors. I even tried booting in troubleshooting mode and creating partitions with fdisk, but neither succeeded.

I then tried making this extra partition at install time and this finally worked, partially. When you add the line “part datastore2 –fstype=vmfs3 –size=1 –grow –ondisk=[DISKTYPE]” there is an extra partition created and mounted as datastore. Which is great. This is still a datastore with 1MB blocksize though.

According to this VMware KB article, you can change the blocksize by using the vmkfstools command. It didn’t work exactly as it says though. This is what I did:

1) do a: fdisk -l
2) find out which partition is the one you want to change.
3) do a:    ls -la /vmfs/devices/disks/
You will now see a list of all the disks, try to find out which partition is the one we’re talking about. In my case it was called:
Then look at the lines starting with vml. Find the one that matches the your disk, which in my case was:
vml.0100000000202020202057442d574341554632393134313937574443205744:6 -> t10.ATA_____WDC_WD6400AACS2D00G8B1________________________WD2DWCAUF2914197:6
4) Now create a new VMFS3 volume on that disk. WARNING !!! All data will be lost:

vmkfstools -C vmfs3 -b 4m -S esx02-loc1 /vmfs/devices/disks/vml.0100000000202020202057442d574341554632393134313937574443205744:6

The vmkfstools command above is all on one line. The options supplied are “-b 4m” for 4MB blocksize, “-S esx02-loc1” for datastore name. After this command has finished, you’re done and you have a big 4MB blocksize partition.  I did notice that in the VI Client directly connected to the host, there was no info on the datastores from the Configuration tab -> Storage. But when you open the properties of the store (right click -> properties) it does show 4MB blocksize.

For those of you who want to use it in a kickstart script, use this code (replace /dev/sda with your configuration):

# Clear Partitions
clearpart –drives=/dev/sda –overwritevmfs
part /boot –fstype=ext3 –size=250 –ondisk=/dev/sda
part cos –fstype=vmfs3 –size=18000 –ondisk=/dev/sda
part None –fstype=vmkcore –size=250 –ondisk=/dev/sda
part datastore2 –fstype=vmfs3 –size=1 –grow –ondisk=/dev/sda

# Start of the COS partitioning
virtualdisk vd1 –size=17000 –onvmfs=cos
part / –fstype=ext3 –size=3000 –onvirtualdisk=vd1 –grow
part swap –fstype=swap –size=1600 –onvirtualdisk=vd1
part /opt –fstype=ext3 –size=4000 –onvirtualdisk=vd1
part /tmp –fstype=ext3 –size=4000 –onvirtualdisk=vd1
part /home –fstype=ext3 –size=4000 –onvirtualdisk=vd1

Ps: I’m NOT using the VMware recommended partitions sizes. This is just an example.
Ps2: Not sure if creating the vmfs partition using vmkfstools will make it alligned, which it would be using vCenter.

/dev/sdd3            2328       77825   606437685    5  Extended
/dev/sdd5            2328        2358      248976   fc  VMware VMKCOR