关于ESX 4.0本地VMFS分区block size的调整方法

ESX 4.0从3.5升级上来有很长一段时间了,突然遇到了本地VMFS分区无法调整block size的问题。

 

特意在vmsky.com上资讯了一下,还真有朋友知道。把问题和解决方法贴出来.

 

根据 BBS论坛内容整理 http://bbs.vmsky.com/thread-23276-1-1.html

 

 

问题:在ESX4默认安装的时候,系统自动分区,形成vmfs分区的Storage1,并且放置了esxconsole.vmdk。默认安装的分区由于受到文件簇的限制,往往在建立虚拟机硬盘时不能达到很大的空间,限制在了259G。原先在ESX3.5中,只要把Storage删除,重新建立存储空间就可以了。但是到了ESX4之后,由于esxconsole.vmdk的存在,反而Storage没法删除了。不知道有什么可以合理得去调整存储空间的方法么?

 

讨论内容:

 

housefullbigmask兄误会楼主的意思了
单一volume的大小跟block size无关,最大不超过2TB

而block size影响着vmfs分区中单一文件的大小, block size为1mb时,vmfs中的单一文件最大不能
超过256GB(这样就不能建立超过256GB的虚拟磁盘)。

楼主是想在local storage中建立超过256gb的虚拟磁盘,这就需要重新设置block size(需要
重新格式化local storage), 但是在esx 4.0中,默认的esx安装会将一个esxconsole vm运行在
local storage 中,这个vm不能暂停和移除,所以就影响了不能重新格式化local storage ...

这是esx 4.0的一个败笔...

 

结论:bigmask找到了正确的方法

 

方法在此 http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1013210

 

内容如下:

 

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 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 pressing d 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

    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// 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.
     
  2. Eject the installation CD, then reboot the ESX host.
  3. 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.
  4. Highlight ESX Server 4.0. Edit the kernel boot parameter for the first menu item by pressing a.
  5. 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.
       
  6. 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.
     
  7. When ESX is online at the status screen, log into the console. You can log in using an SSH client.
  8. Edit the /etc/vmware/esx.conf file using a text editor. 
  9. 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"
     
  10. Save your changes and return to the prompt.
  11. Run the command esxcfg-boot -b to update the ESX host boot configuration and initial RAM disk image.
  12. (Optional) Using the reboot command, restart the ESX host to verify that it boots without manual intervention or error.

 

 

你可能感兴趣的:(Linux平台应用技术)