博威---云架构决胜云计算

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2008|回复: 2

在ESX4默认安装的文件块大小

[复制链接]
发表于 2011-7-8 16:07:32 | 显示全部楼层 |阅读模式
在ESX4默认安装的时候,系统会自动分区,形成vmfs分区的Storage1,并且放置了esxconsole.vmdk。默认安装的分区由于受到文件簇的限制,往往在建立虚拟机硬盘时不能达到很大的空间,限制在了259G。原先在ESX3.5中,只要把Storage删除,重新建立存储空间就可以了。但是到了ESX4之后,由于esxconsole.vmdk的存在,反而Storage没法删除了

查看了VM的官网,发现了解决方案,http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1013210
不过操作起来还是比较麻烦

其中一个解决方案是先安装VM3.5,修改block size为8M后再升级到4.0的方案相对简单,就是操作上要装两次VM,但是VM安装是比较简单的,我采用这个方法成功的安装了块大小为8M的新ESX server,希望VM后续版本能改掉这个BUG

VM3.5ESX的升级有3种方法Update Manager、Host Update Utility或者用光盘安装
Update Manager方式:
进入vCenter Server选择HOME-Hosts and cluster
随便选择一台esx主机在Update Manager选单中选择PATCH方式的Baselines右键选择Detach Baseline把老的更新的基准删除,在选择Detach Baseline会有一个Hosts and cluster选择框,可以全选这样就能一步删除所有的Update Manager中的基准了。
再进入HOME-Update Manager,在上部选择upgrade Baseline,新建一个基准,注意在新建的时候下面确认选择的是host upgrade类型,下一步选择ESX upgrade iso,browse选择下载好的esx4的iso文件,再下一步如果有个证书警告的对话框勾选下面安装选项并点忽略,接下来会有一个上传过程,等待结束后继续下一部选择COS VMDK location 这里如果ESX本地VMDK有10GB剩余空间的话就选第一个,如果本机VMDK空间不足就选择第二项让系统自动选择或者第三项自己制定个共享的VMDK,后面反复下一步知道finish。这样一个host upgrade的Baseline就建好了。
回到HOME-Hosts and cluster选中要升级的esx进入Update Manager选单,attach刚刚建立好的Baseline,添加完成后scan选择upgrades对主机进行一次扫描,扫描完成后会有提示需要upgrade,选择下面的remediate,进入修复界面按照提示下一步当中也会有个COS VMDK location 的选择参照上面的说明选择继续下一步只到完成,这时候就会有修复任务在对esx进行升级了。经过一个漫长的等待期间esx还会进行重启,所有会有断开的警告,这都属正常,到最后升级完成esx就恢复正常状态了,如果有大批量的机器需要升级可以把Baseline附加到整个cluster,这样扫描和修复就是批量化了。

Host Update Utility方式:
可能在某些安装环境下比如服务器有多个ip,修改过端口啊,还有计算机名称和dns name不一样啊都会导致Update Manager出现各种问题(可以搜索下我以前写过的2篇关于Update Manager故障的博文),导致无法正常Update Manager,那么我们就要使用Host Update Utility来进行升级了。
在开始菜单-程序-vmware里选择vSphere Host Update Utility 4.0进入Host Update Utility
Host Update Utility的方式升级相对Update Manager要简单许多,适合esx机器数量较少的环境,在进入Host Update Utility后会有个选择下载patch的对话框,这里选择no,因为我们是upgrade不是打补丁。
首先要在vSphere Server里面把你需要升级的esx进入维护模式并且从cluster里面断开。
如果列表里面没有你的esx可以通过上方的add host添加,选择需要更新的esx主机点击下方的upgrade host进入下一步,选择esx4的iso,继续下一步一直到console os setting 也就是COS 设置,安装前面的规则选择一个合适的VMDK卷下方的disk size选择10GB,总得留点余地。然后一直下一步直到finish,开始升级。升级完成后再在vSphere Server的cluster重新连接升级完成的esx。

至于光盘安装的升级方式这里就不说了,基本和安装也没太多区别,不过也记得先进入维护模式并且从cluster里面断开后在升级。

由于是新安装ESX ,因此我采用安装ESX3.5后直接光盘升级到4.0,通过VC连接查看后,发现块大小已经修改为8M
 楼主| 发表于 2011-7-8 16:07:53 | 显示全部楼层
调整ESX的VMFS磁盘格式的块大小,让单个虚拟磁盘支持更大容量
前因:客户搭建了VMware ESX企业版的测试平台;有一天接到一个需求,是测试数据库的,需要一个300G的磁盘。

解决过程:

1、按照操作手册,找到磁盘修改选项,准备调整磁盘大小由原来的150G调整为300G,当修改完数值时,确定后却出现错误提示,说可分配最大空间为256G。

2、与VMware工程师联系,提供的解决方案是:vmkfstools 磁盘扩容命令

      2.1 vmkfstools -X 300G 1.Windows\ 2003\(hezt\)-flat.vmdk

           参数说明:

           -X  扩容参数

          300G  扩容后整个磁盘的大小,而不是磁盘增加的大小

          1.Windows\ 2003\(hezt\)-flat.vmdk  需要扩容的磁盘

      2.2 在输入命令时,空格的地方需要在其前面加反斜杠“\”进行转义,否则会报错

      2.3 执行结果依然报错,提示错误信息和用图形界面操作一样

3、思考:图形界面的修改其实也是调用vmkfstools 命令来执行,这个肯定不是最终解

4、查资料:其实VMware以它独有的格式来存放这些虚拟机文件,即VMFS,安装时  默认的VMFS块大小是1M,单个文件最大支持256G。这个是不能分配300G的最终根源

5、解决-思路:重新格式化VMFS盘,将块大小调大

      5.1  注:此操作其实就是重建VMFS盘,上面原有数据会失去,所以先将重要的数据备份,再执行此操作;我觉得最好在安装完ESX后首先就执行,免去以后执行的不便。

      5.2   块大小与支持的最大文件大小对应关系

             Block size    Max VMDK size
                 1                    256 GB
                 2                    512 GB
                 4                    1024 GB
                 8                    2048 GB

6、备份之后执行:

      vmkfstools -C vmfs3 -b 4M -S esx03:storage1 vmhba1:0:0:3

      参数说明:

      -C vmfs3 指定磁盘格式为 vmfs3

      -b 4M  将块大小调整为 4M,这样支持单个最大文件为1T

      -S esx03:storage1 将格式化后的盘命名为esx03:storage1

       vmhba1:0:0:3 目的磁盘路径,这个可在配置——存储——中的Device很方便的看到

7、执行过程稍长…… (2~3分钟)

8、问题解决。
 楼主| 发表于 2011-7-8 16:13:06 | 显示全部楼层
Increasing the block size of local VMFS storage in ESX 4.x during installationPurpose

This article provides instructions on how to specify a block size during the formatting process of VMware ESX 4.x. By default it formats them with a 1MB block size, allowing for storage of files 256GB and under. This default VMFS Datastore cannot be easily reformatted with a higher block size as it contains the Service Console VMDK file.

This article is not applicable to ESXi, as there is no Service Console or associated VMDK file. The default VMFS Datastore is blank, and can be deleted and reformatted post-install. It is not necessary to change the VMFS Datastore block size during the installation.


ResolutionThe ESX 4.x installer utilizes the default block size of 1MB when creating VMFS volumes. For additional information on the VMFS block size, see the
Additional Information
section, below.



The service console in ESX 4.x is stored in a VMDK file on a VMFS partition, typically located on local storage. While VMware ESX 4.x is running, you cannot reformat the volume with the intended block size. If you have already completed an installation of VMware ESX 4.x, are unable to reinstall the product with the intended block size using steps provided below, and you require a larger block size on the local VMFS partition,
see
Reformatting the local VMFS partition's block size in ESX 4.x (post-installation) (1013210).

New Installations: Formatting with a VMFS block size larger than 1MB
While the installer can be modified to format any new VMFS partitions with a specified block size, the following workarounds are also available:

  • Re-install the ESX host on a different drive (for example, a second RAID set or boot from SAN), and leave the original disk for the VMFS volume. You can then choose your blocksize when creating the second datastore at a later time.
  • Alternatively, install ESX 3.5, create the volume with desired blocksize or re-format the volume with the intended block size, then upgrade to ESX 4.x. Specify to use the existing VMFS volume to store your Console OS VMDK.
  • Create a second RAID set, forming a discrete device or volume which can be utilized with the intended block size, post-installation.

  • Carve out a new LUN, volume, on the local controller for a new volume. This, too can be utilized with the intended block size post-installation, but additional proecdures are required:

    Note: You cannot create a second datastore (via another partition) on the same drive via the ESX GUI. You must use the vmkfstools command.
    You may also need to create a partition on the free space first with fdisk:
vmkfstools -C vmfs -b Xm -S local2mBS /vmfs/devices/disks/naa.xxxxxxxxxx:y

Where:
  • Xm
    is the blocksize (1m, 2m, 4m, or 8m).
  • local2mBS
    is your volume name. If the volume name has a space (for example, volume name), enclose it in quotation marks (for example, "volume name").
  • naa
    is the naa identifier, and
    y
    is the partition number. To determine this, run ls -la
    in the/vmfs/devices/disks
    folder.

Note: Depending on your disk controller type,
naa.
may be replaced with
eui.,
t10., or
mpx.. For more information, see
Identifying disks when working with VMware ESX (1014953).

Reconfiguring the ESX 4.x installer and formatting new VMFS volumes with a specific block size

To reconfigure the installer to format VMFS partitions with a specified block size:

  • Boot the ESX installation DVD and choose
    Install in graphical mode.
  • Press
    Ctrl+Alt+F2
    to switch to the shell.
  • Run:

    ps | grep Xorg
      
  • Kill the PID which shows Xorg -br -logfile ....

    For example, run:

    kill 590

    Where
    590
    is the PID, per above.

    Notes
    :
    • If you specified a GUI mode installation, killing the process identified as
      Xorg
      may switch you back to another console. If this occurs, press
      Ctrl+Alt+F2
      to return to the previous console.
    • If after killing the
      Xorg

      process you get the message "Press <return> to reboot", pressCtrl+Alt+F3
      to go to another console and continue working there without rebooting.
  • To switch to the configuration directory, run:

    cd /usr/lib/vmware/weasel

  • To edit the configuration script, run:

    vi fsset.py

    Note: For more information on editing files, see Editing configuration files in VMware ESX (1017022).
  • Locate
    class vmfs3FileSystem(FileSystemType)
    .

  • Edit the
    blockSizeMB
    parameter to the block size that you want. It is currently be set to 1. The only values that work correctly are 1, 2, 4, and 8.

    Note: Press
    i
    for insert mode.
  • To save and close the file, press
    Esc, type
    :wq!
    and press
    Enter. The exclamation mark is needed to force the action of saving as the file is read only.

  • Verify that the content has been changed running:

    grep -i blockSizeMB fsset.py
  • To switch back to the root directory, run:

    cd /
  • To launch the installer with the new configuration, run:

    /bin/weasel

Additional InformationThe largest file that can be created with a 1MB block size is 256GB in size. For more information about the maximum file size, see the
Configuration Maximums
for your version of ESX.

To create a file bigger than 256GB, the VMFS filesystem needs to have a block size larger than 1MB. The maximums are as follows:


Block Size
Maximum File Size
1 MB
256 GB
2 MB
512 GB
4 MB
1 TB
8 MB
2 TB


For more information about block sizes, see Verifying the block size of a VMFS datastore (1003565).


您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|boway Inc. ( 冀ICP备10011147号 )

GMT+8, 2024-4-26 16:25 , Processed in 0.084359 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表