Fork me on GitHub

虚拟化之esxi命令行管理之二

/vmfs # ls -l
lrwxrwxrwx    1 root     root             4 Mar 23  2013 devices -> /dev
drwxr-xr-x    1 root     root           512 Sep 21 03:29 volumes
/vmfs # cd volumes/
/vmfs/volumes # ls -l
drwxr-xr-x    1 root     root             8 Jan  1  1970 537e35f7-f37c1097-6876-00e04c21c7a5
drwxr-xr-t    1 root     root          3640 Sep 17 08:53 537e3601-83e8ce86-8c6f-00e04c21c7a5
drwxr-xr-x    1 root     root             8 Jan  1  1970 537e3602-57ab150e-12ac-00e04c21c7a5
drwxr-xr-x    1 root     root             8 Jan  1  1970 76bb5275-c62f6af6-c490-8b76701604db
lrwxr-xr-x    1 root     root            35 Sep 21 03:29 datastore1 -> 537e3601-83e8ce86-8c6f-00e04c21c7a5
drwxr-xr-x    1 root     root             8 Jan  1  1970 e1569476-ffac720f-793a-42482c57cdc3
/vmfs/volumes # cd datastore1/
/vmfs/volumes/537e3601-83e8ce86-8c6f-00e04c21c7a5 # ls -l
drwxr-xr-x    1 root     root           420 May 11 00:58 123-converter
-rw-------    1 root     root     417333248 Jun 24  2014 CentOS-6.5-x86_64-minimal.iso
-rw-------    1 root     root     226224128 Aug 21  2014 FreeNAS-9.2.1.5-RELEASE-x64.iso
drwxr-xr-x    1 root     root           560 Jul 15  2014 centos-6.5
drwxr-xr-x    1 root     root          1120 Jul 15  2014 centos-min-6.5-64
drwxr-xr-x    1 root     root          2660 Aug 31 12:34 cs
-rw-------    1 root     root      78198784 Jun 11  2014 hsrouter_V8.0_Build20131022.iso
-rw-------    1 root     root     1285396902 Nov  3  2014 linux_11gR2_database_1of2.zip
-rw-------    1 root     root     995359177 Nov  3  2014 linux_11gR2_database_2of2.zip
drwxr-xr-x    1 root     root          2800 Sep 17 08:50 mec
drwxr-xr-x    1 root     root          3220 Sep  1 01:56 mrtg
drwxr-xr-x    1 root     root          2240 Nov  3  2014 oracle-shiyan
drwxr-xr-x    1 root     root          1260 Aug 14  2014 ori
drwxr-xr-x    1 root     root          2100 Sep 17 09:29 test1
-rw-------    1 root     root     630237184 Aug 21  2014 windows_cn_xp_sp3.iso

/dev/disks # ls
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0    vml.01000000002020202020202020202020205a33544659364830535435303044
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:1  vml.01000000002020202020202020202020205a33544659364830535435303044:1
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:2  vml.01000000002020202020202020202020205a33544659364830535435303044:2
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:3  vml.01000000002020202020202020202020205a33544659364830535435303044:3
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:5  vml.01000000002020202020202020202020205a33544659364830535435303044:5
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:6  vml.01000000002020202020202020202020205a33544659364830535435303044:6
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:7  vml.01000000002020202020202020202020205a33544659364830535435303044:7
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:8  vml.01000000002020202020202020202020205a33544659364830535435303044:8
/dev/disks # ls -l
-rw-------    1 root     root     500107862016 Sep 21 03:24 t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0
-rw-------    1 root     root       4161536 Sep 21 03:24 t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:1
-rw-------    1 root     root     4293918720 Sep 21 03:24 t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:2
-rw-------    1 root     root     494870208000 Sep 21 03:24 t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:3
-rw-------    1 root     root     262127616 Sep 21 03:24 t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:5
-rw-------    1 root     root     262127616 Sep 21 03:24 t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:6
-rw-------    1 root     root     115326976 Sep 21 03:24 t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:7
-rw-------    1 root     root     299876352 Sep 21 03:24 t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:8
lrwxrwxrwx    1 root     root            73 Sep 21 03:24 vml.01000000002020202020202020202020205a33544659364830535435303044 -> t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0
lrwxrwxrwx    1 root     root            75 Sep 21 03:24 vml.01000000002020202020202020202020205a33544659364830535435303044:1 -> t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:1
lrwxrwxrwx    1 root     root            75 Sep 21 03:24 vml.01000000002020202020202020202020205a33544659364830535435303044:2 -> t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:2
lrwxrwxrwx    1 root     root            75 Sep 21 03:24 vml.01000000002020202020202020202020205a33544659364830535435303044:3 -> t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:3
lrwxrwxrwx    1 root     root            75 Sep 21 03:24 vml.01000000002020202020202020202020205a33544659364830535435303044:5 -> t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:5
lrwxrwxrwx    1 root     root            75 Sep 21 03:24 vml.01000000002020202020202020202020205a33544659364830535435303044:6 -> t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:6
lrwxrwxrwx    1 root     root            75 Sep 21 03:24 vml.01000000002020202020202020202020205a33544659364830535435303044:7 -> t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:7
lrwxrwxrwx    1 root     root            75 Sep 21 03:24 vml.01000000002020202020202020202020205a33544659364830535435303044:8 -> t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0:8

~ # partedUtil getptbl /vmfs/devices/disks/t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0
gpt
60801 255 63 976773168
1 64 8191 C12A7328F81F11D2BA4B00A0C93EC93B systemPartition 128
5 8224 520191 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0
6 520224 1032191 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0
7 1032224 1257471 9D27538040AD11DBBF97000C2911D1B8 vmkDiagnostic 0
8 1257504 1843199 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0
2 1843200 10229759 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0
3 10229760 976773134 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
~ # partedUtil get /vmfs/devices/disks/t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0
60801 255 63 976773168
1 64 8191 0 128
5 8224 520191 0 0
6 520224 1032191 0 0
7 1032224 1257471 0 0
8 1257504 1843199 0 0
2 1843200 10229759 0 0
3 10229760 976773134 0 0
~ # partedUtil showGuids
 Partition Type       GUID
 vmfs                 AA31E02A400F11DB9590000C2911D1B8
 vmkDiagnostic        9D27538040AD11DBBF97000C2911D1B8
 vsan                 381CFCCC728811E092EE000C2911D0B2
 VMware Reserved      9198EFFC31C011DB8F78000C2911D1B8
 Basic Data           EBD0A0A2B9E5443387C068B6B72699C7
 Linux Swap           0657FD6DA4AB43C484E50933C84B4F4F
 Linux Lvm            E6D6D379F50744C2A23C238F2A3DF928
 Linux Raid           A19D880F05FC4D3BA006743F0F84911E
 Efi System           C12A7328F81F11D2BA4B00A0C93EC93B
 Microsoft Reserved   E3C9E3160B5C4DB8817DF92DF00215AE
 Unused Entry         00000000000000000000000000000000

 

~ # esxcli storage core adapter list
HBA Name  Driver     Link State  UID            Description
--------  ---------  ----------  -------------  --------------------------------------------------------------------
vmhba0    ata_piix   link-n/a    sata.vmhba0    (0:0:31.2) Intel Corporation Cougar Point 4 port SATA IDE Controller
vmhba1    ata_piix   link-n/a    sata.vmhba1    (0:0:31.5) Intel Corporation Cougar Point 2 port SATA IDE Controller
vmhba32   ata_piix   link-n/a    sata.vmhba32   (0:0:31.2) Intel Corporation Cougar Point 4 port SATA IDE Controller
vmhba33   ata_piix   link-n/a    sata.vmhba33   (0:0:31.5) Intel Corporation Cougar Point 2 port SATA IDE Controller
vmhba34   iscsi_vmk  online      iscsi.vmhba34  iSCSI Software Adapter
~ # esxcli storage core adapter stats get
vmhba0
   Successful Commands: 0
   Blocks Read: 0
   Blocks Written: 0
   Read Operations: 0
   Write Operations: 0
   Reserve Operations: 0
   Reservation Conflicts: 0
   Failed Commands: 256
   Failed Blocks Read: 0
   Failed Blocks Written: 0
   Failed Read Operations: 0
   Failed Write Operations: 0
   Failed Reserve Operations: 0
   Total Splits: 0
   PAE Commands: 0
~ # esxcli storage core device vaai status get
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0
   VAAI Plugin Name:
   ATS Status: unsupported
   Clone Status: unsupported
   Zero Status: supported
   Delete Status: unsupported
~ # esxcli storage core device partition list
Device                                                                     Partition  Start Sector  End Sector  Type          Size
-------------------------------------------------------------------------  ---------  ------------  ----------  ----  ------------
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          0             0   976773168     0  500107862016
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          1            64        8192     0       4161536
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          2       1843200    10229760     6    4293918720
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          3      10229760   976773135    fb  494870208000
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          5          8224      520192     6     262127616
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          6        520224     1032192     6     262127616
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          7       1032224     1257472    fc     115326976
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          8       1257504     1843200     6     299876352
~ # esxcli storage core device partition showguid
Device                                                                     Partition  Layout  GUID
-------------------------------------------------------------------------  ---------  ------  --------------------------------
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          0  GPT     00000000000000000000000000000000
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          1  GPT     c12a7328f81f11d2ba4b00a0c93ec93b
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          2  GPT     ebd0a0a2b9e5443387c068b6b72699c7
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          3  GPT     aa31e02a400f11db9590000c2911d1b8
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          5  GPT     ebd0a0a2b9e5443387c068b6b72699c7
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          6  GPT     ebd0a0a2b9e5443387c068b6b72699c7
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          7  GPT     9d27538040ad11dbbf97000c2911d1b8
t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          8  GPT     ebd0a0a2b9e5443387c068b6b72699c7
~ # esxcli storage core plugin list
Plugin name  Plugin class
-----------  ------------
NMP          MP
~ # esxcli storage vmfs extent list
Volume Name  VMFS UUID                            Extent Number  Device Name                                                                Partition
-----------  -----------------------------------  -------------  -------------------------------------------------------------------------  ---------
datastore1   537e3601-83e8ce86-8c6f-00e04c21c7a5              0  t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0          3

~ # esxcli storage filesystem list Mount Point Volume Name UUID Mounted Type Size Free ------------------------------------------------- ----------- ----------------------------------- ------- ------ ------------ ----------- /vmfs/volumes/537e3601-83e8ce86-8c6f-00e04c21c7a5 datastore1 537e3601-83e8ce86-8c6f-00e04c21c7a5 true VMFS-5 494726545408 72710356992 /vmfs/volumes/537e3602-57ab150e-12ac-00e04c21c7a5 537e3602-57ab150e-12ac-00e04c21c7a5 true vfat 4293591040 4256366592 /vmfs/volumes/76bb5275-c62f6af6-c490-8b76701604db 76bb5275-c62f6af6-c490-8b76701604db true vfat 261853184 125140992 /vmfs/volumes/e1569476-ffac720f-793a-42482c57cdc3 e1569476-ffac720f-793a-42482c57cdc3 true vfat 261853184 109809664 /vmfs/volumes/537e35f7-f37c1097-6876-00e04c21c7a5 537e35f7-f37c1097-6876-00e04c21c7a5 true vfat 299712512 84123648

 

~ # esxcli vm process list
mrtg
   World ID: 37586
   Process ID: 0
   VMX Cartel ID: 37584
   UUID: 56 4d 21 8b 6a 26 87 8f-2e 5f f9 6f d1 1b 40 74
   Display Name: mrtg
   Config File: /vmfs/volumes/537e3601-83e8ce86-8c6f-00e04c21c7a5/mrtg/mrtg.vmx

test1
   World ID: 1039588
   Process ID: 0
   VMX Cartel ID: 1039587
   UUID: 56 4d 52 a8 4a 48 f7 4e-ff c8 48 6e 5a 60 25 dc
   Display Name: test1
   Config File: /vmfs/volumes/537e3601-83e8ce86-8c6f-00e04c21c7a5/test1/test1.vmx

cs
   World ID: 3688
   Process ID: 0
   VMX Cartel ID: 3678
   UUID: 42 25 49 7d 81 55 c1 85-9a 36 00 94 30 e1 d1 4c
   Display Name: cs
   Config File: /vmfs/volumes/537e3601-83e8ce86-8c6f-00e04c21c7a5/cs/cs.vmx

 

 

~ # esxcli vm process list
查看虚拟机 ~ # vim-cmd vmsvc/getallvms 启动虚拟机
~ # vim-cmd vmsvc/power.on 39

1. 使用如下命令获取正在运行的虚拟机清单,该清单由VMID、Display Name和 .vmx 配置文件所在路径构成:
#vim-cmd vmsvc/getallvms 2. 获取虚拟机的当前状态: #vim-cmd vmsvc/power.getstate VMID
3. 使用第2步获取的VMID 来关闭虚拟机: #vim-cmd vmsvc/power.shutdown VMID Note: 如果虚拟机还是不能关闭,请尝试以下命令:
#vim-cmd vmsvc/power.off VMID

 

posted on 2015-09-21 11:28  阳光-源泉  阅读(2645)  评论(0编辑  收藏  举报

导航