Friday, January 21, 2011

How to create a vmfs file system with ESXI 4.1

How to create a vmfs file system from the command line

1. After adding a new disk, type esxcfg-scsidevs -c (compressed view) to gather
    information about all the disks and the runtime name of the new device
    In this example, the runtime name was mpx.vmhba1:C0:T1:L0

2. Use the fdisk command to partition the new disk and set the partition type to
    0xfb (vmfs type). In this case, I used the command used was:
    fdisk /dev/disks/mpx.vmhba1:C0T1L0.
    You may need to use commands like "p" to view the  existing partitions, "n" to
    create a new one using 100% of the disk and "t" to specify the type. Once this
    is done, use the "w" command to write/save the changes.

This is what the disk will look like by the time one is finished:

 # fdisk /dev/sdh

The number of cylinders for this disk is set to 10240.
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/sdh: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdh1               1       10240    10485744   fb  VMware VMFS

3. Once the disk is partitioned properly, the vmkfstools command is needed. To
    create a new file system and a new datastore, The command used was:

vmkfstools -C vmfs3 -b 1M -S MyDatastore mpx.vmhba1:C0:T1:L0:1
vmkfstools -C vmfs3 -b 1M -S Daniel /vmfs/devices/disk/naa.60060160e09028008e4d328c91a2df11:1

Final Note: The -S option was used to specify the datastore name
                   The -b option was used to specify the block size
                   The -C option was used to create a new file system
                   The :1 option used at the end of the command specifies the new slice

How to grow the file system by using a second extent:

Use the vml (symbolic link) of the second disk and add it to the original disk (the one with the
file system). Use the -Z option to add another extent. Don't use the -G option. The -G option
grows the file system size by using the rest of the first disk (whatever is unused).

Obtain the information about the two disks you are using:

cd /vmfs/devices/disks
ls -al | grep -i naa.60060160e09028008e4d328c91a2df11
ls -al | grep -i naa.60060160e0902800ef19e58491a2df11

Add the second extent to the first one:

vmkfstools -Z vml.020011000060060160e0902800ef19e58491a2df11524149442035:1 vml.020012000060060160e09028008e4d328c91a2df11524149442035:1

No comments:

Post a Comment