vSphere 6.5 – DRS CPU Over-Commitment


A lot of VMware vSphere architects and engineers are designing their vSphere clusters for some overbooking ratios to define some level of the service (SLA or OLA) and differentiate between different compute tiers. They usually want to achieve something like

  • Tier 1 cluster (mission-critical applications) – 1:1 vCPU / pCPU ratio
  • Tier 2 cluster (business-critical applications) – 3:1 vCPU / pCPU ratio
  • Tier 3 cluster (supporting applications) – 5:1 vCPU / pCPU ratio
  • Tier 4 cluster (virtual desktops) – 10:1 vCPU / pCPU ratio

Before vSphere 6.5 we have to monitor it externally by vROps or some other monitoring tool. Some time ago I have blogged how to achieve it with PowerCLI and LogInsight – ESXi host vCPU/pCPU reporting via PowerCLI to LogInsight.

继续阅读“vSphere 6.5 – DRS CPU Over-Commitment”

sed -i命令详解


[root@www ~]# sed [-nefr] [动作]
-n :使用安静(silent)模式。在一般 sed 的用法中,所有来自 STDIN 的数据一般都会被列出到终端上。但如果加上 -n 参数后,则只有经过sed 特殊处理的那一行(或者动作)才会被列出来。
-e :直接在命令列模式上进行 sed 的动作编辑;
-f :直接将 sed 的动作写在一个文件内, -f filename 则可以运行 filename 内的 sed 动作;
-r :sed 的动作支持的是延伸型正规表示法的语法。(默认是基础正规表示法语法)
-i :直接修改读取的文件内容,而不是输出到终端。

动作说明: [n1[,n2]]function
n1, n2 :不见得会存在,一般代表『选择进行动作的行数』,举例来说,如果我的动作是需要在 10 到 20 行之间进行的,则『 10,20[动作行为] 』

a :新增, a 的后面可以接字串,而这些字串会在新的一行出现(目前的下一行)~
c :取代, c 的后面可以接字串,这些字串可以取代 n1,n2 之间的行!
d :删除,因为是删除啊,所以 d 后面通常不接任何咚咚;
i :插入, i 的后面可以接字串,而这些字串会在新的一行出现(目前的上一行);
p :列印,亦即将某个选择的数据印出。通常 p 会与参数 sed -n 一起运行~
s :取代,可以直接进行取代的工作哩!通常这个 s 的动作可以搭配正规表示法!例如 1,20s/old/new/g 就是啦!
继续阅读“sed -i命令详解”

How to use VMware vSphere PowerCLI to find a virtual machine by MAC address


Sometimes you need to find a virtual machine by MAC address. This can be very time consuming if you have to do this by hand using the VMware vSphere Client. PowerCLI can do this task for you in only a few seconds. The script presented in this blogpost will retrieve the virtual machine that has a certain MAC address.

You can find the virtual machine with a certain MAC address by just using the PowerCLI Get-VM and Get-NetworkAdapter cmdlets and piping these together. E.g. to find the virtual machine with MAC address “00:0c:29:1d:5c:ec” you can give the following PowerCLI command:

 Get-VM | `
Get-NetworkAdapter | `
Where-Object {$_.MacAddress -eq "00:0c:29:1d:5c:ec"} | `
Format-List -Property *
继续阅读“How to use VMware vSphere PowerCLI to find a virtual machine by MAC address”

LVM Cache on ubuntu 18.04 LTS




lvcreate -n cache -L 9G vg_faster
lvcreate -n meta -l 100%FREE vg_faster
vgextend 8t_test /dev/disk/by-id/wwn-0x5e83a97ee1537d85-part5
lvcreate --type cache-pool --name cache -L 8G 8t_test /dev/disk/by-id/wwn-0x5e83a97ee1537d85-part5
lvconvert --type cache --cachepool 8t_test/cache 8t_test/8tall
继续阅读“LVM Cache on ubuntu 18.04 LTS”