Reformatting the local VMFS partition's block size in ESX 4.0

 

Reformatting the local VMFS partition's block size in ESX 4.0

Purpose

This article provides steps to reformat the local VMFS partition's block size in ESX 4.0.

Resolution

Currently, the ESX 4.0 installer does not provide a way to format the local VMFS3 partition with a block size larger than 1MB. Changing this is impossible without relocating the Console OS VMDK after installation, which is not possible while ESX 4.0 is booted.
 
There are a number of workarounds available to utilize a larger block size for the local VMFS file system. These options are the easiest:
  • Create two logical units for the local storage device(s) in the server, utilizing the first for the ESX 4.0 installation and a VMFS volume with the default block size. The second may be formatted later with a larger block size.
  • Format the local VMFS partition on ESX 3.5 with a larger block size, then upgrade the host to ESX 4.0.
If these methods are not suitable, you can reformat the existing ESX 4.0 local VMFS partition with a larger block size using the ESX 4.0 installer environment.
 
To reformat the ESX 4.0 local VMFS partition with a larger block size, you require:
  • A completed installation of ESX 4.0
  • The ESX 4.0 installation CD
  • A storage device (8.5GB or larger) to temporarily store the Console OS. This device can be a USB flash/hard disk, SAN LUN, secondary SCSI disk, or a remote SSH server.

    Note: If you are using a flash/hard drive, it is reformatted in the steps below. 
Booting into the installer
 
To boot into the installer:
  1. If you do not done so already, complete an installation of ESX 4.0. This provides the standard local VMFS partition block size of 1MB.
  2. Shut down the ESX host.
  3. Insert, attach, or present the temporary storage device to the ESX host. If you are using an SSH server, disregard this step.
  4. Power on the ESX host.
  5. Boot into the ESX 4.0 installer and select either the graphical or text installer.
  6. Complete the driver loading stage within the chosen installer. This loads the VMkernel drivers required to access the existing VMFS partition.
  7. When you are prompted about the license, choose Evaluation mode. You do not need to configure licensing.
  8. Complete the network configuration steps. After opting for DHCP or manual configuration, click the Test button. This commits the networking changes.
Preparing the USB flash/hard drive or alternate block device
 
To prepare the storage device:
  1. Open an alternate TTY session by pressing Ctrl+Alt+F2. Press Enter to start the login session.
  2. Run fdisk <device> to modify the partitions for the newly-added device.

    No
    te: Representation of attached devices varies between servers. A USB device used for the purposes of this article is recognized as /vmfs/devices/disks/mpx.vmhba32:C0:T0:L0.
     
  3. Print the current partition table to ensure that the correct drive is selected by pressing p in fdisk.

    Notes:
    • If you have selected an incorrect device, press q to quit, then try another device.
    • If you are using an old drive or it contains partitions you need to remove, you can destroy the partition table entries by pressingd in fdisk.
       
  4. Press n to create a Linux EXT3 partition on this device (default). You may use the default parameters and partition the whole device.
  5. When you are finished, press w to write the changes and quit fdisk.
  6. After partitioning, format the new partition as EXT3. For example:

    mkfs.ext3 /vmfs/devices/disks/mpx.vmhba32:C0:T0:L0:1

    Note: If you see a prompt that indicates that the partition is not a block special device, click Continue.
     
  7. Create a directory or mount point for the device. For example:

    mkdir /mnt/mydrive
     
  8. Mount the filesystem with the command:

    mount -t ext3 <device path> <mount point>

    For example:

    mount -t ext3 /vmfs/devices/disks/mpx.vmhba32:C0:T0:L0:1 /mnt/drive
     
  9. Copy the console OS directory to the mount point. For example:

    cp -R /vmfs/volumes/Storage1/esxconsole* /mnt/drive

    Note: This process can take some time as the Console OS VMDK is several gigabytes.
  Alternatively, you can secure-copy the Console OS to a network location:
  1. Verify that you can reach your designated SSH server from the console using ping.
  2. SCP the contents of the Console OS directory to the SSH server. Adjust the following command as required:

    scp -r /vmfs/volumes/Storage1/esxconsole*
     username@server:/destination_directory

    Note: The specified SSH server and its storage must have capacity and support for files of 8GB in size and larger.
Reformatting the local VMFS partition with a larger block size
 
Reformat the original VMFS volume with your desired block size.
 
For example, to format it with an 8MB block size and name it Storage1, run the command:
vmkfstools -C vmfs3 -b 8m -S Storage1 /vmfs/devices/disks/mpx.vmhba0:C0:T0:L0:5

Note: The local storage device address may be different on your server. Ensure that you have the correct device and partition selected before formatting with the vmkfstools command. In the above example, the VMFS3 volume was in the fifth partition (highlighted in blue). While this is the default configuration, your configuration may still be different. For example, it may have a different vmhba (highlighted in red), controller (C), target (T), or LUN (L) number. 

Copying the Console OS directory back from the mount point 
 
If you used a USB flash/hard drive or alternate block device, copy the Console OS directory from your secondary drive back to the VMFS volume.  For example:
cp -R /mnt/drive/* /vmfs/volumes/Storage1 
If you used an SSH server, use SCP to copy the Console OS back from the SSH server to the new VMFS volume. For example:
scp –r  username@server:/copied-directory  /vmfs/volumes/Storage1
Reconfiguring the ESX host
 
To reconfigure the ESX host:
  1. Navigate to the /vmfs/volumes/Storage1/<cos-location>/ directory. Run pwd and record the absolute path to the Console OS VMDK file. For example:

    # pwd

    /vmfs/volumes/4a79e784-066e4fef-9d4b-005056ab7e20/esxconsole-4a785116-c442-9826-6f60-005056ab7e20/

    Note: The VMDK filename is esxconsole.vmdk.
     
  1. Eject the installation CD, then reboot the ESX host.
  2. Interrupt the GRUB Bootloader. During startup, you have a few seconds to select ESX Server 4.0 or Troubleshooting Mode. Press a cursor key or a meta key to interrupt the countdown.
  3. Highlight ESX Server 4.0. Edit the kernel boot parameter for the first menu item by pressing a.
  4. Add the now-required /boot/cosvmdk parameter to your kernel boot line. It must be at the beginning of the line, preceding the values that are already provided already (do not erase them). For example:
    • Before: 

      grub append> ro root=UUID=d01bc3a8-1e83-47ea-8250-a77cd15fc54 mem=300M quiet
       
       
    • After: 

      grub append> /boot/cosvmdk=/vmfs/volumes/4a79e784-066e4fef-9d4b-005056ab7e20/esxconsole-4a785116-c442-9826-6f60-005056ab7e20/esxconsole.vmdk ro root=UUID=d01bc3a8-1e83-47ea-8250-a77cd15fc54 mem=300M quiet

      Note: Double-check your input. Typographical errors may result in a failed boot-up.
       
  5. Press Enter to save the change. This resumes the booting of ESX.

    No
    te: If you are returned to a recovery shell, there may have been a typographical error in step 5, or there may be other issues reaching the file or starting the host. You can retry the steps in this section (Reconfiguring the ESX host), or you can contact VMware Technical Support for assistance as there may be other issues. For more information on contacting VMware Technical Support, see How to Submit a Support Request.
     
  6. When ESX is online at the status screen, log into the console. You can log in using an SSH client.
  7. Edit the /etc/vmware/esx.conf file using a text editor. 
  8. Locate the line that specifies the Console OS vmdk path and replace the path with the value or path recorded in step 1. For example:

    /boot/cosvmdk = "/vmfs/volumes/4a79e784-066e4fef-9d4b-005056ab7e20/esxconsole-4a785116-c442-9826-6f60-005056ab7e20/esxconsole.vmdk"
     
  9. Save your changes and return to the prompt.
  10. Run the command esxcfg-boot -b to update the ESX host boot configuration and initial RAM disk image.
  11. (Optional) Using the reboot command, restart the ESX host to verify that it boots without manual intervention or error.

 

 

你可能感兴趣的:(ESX4.0,Blocksize)