zoukankan      html  css  js  c++  java
  • 原创:vsphere概念深入系列三:vSphere命令行管理

    假设无法近距离接触物理主机,只能远程命令行管理,。

    以下命令行可以起到点作用。

    首先需要安装vSphere CLI工具。

    image

    启动后界面:

    image

    1.查看datastore内容

    所有命令行工具都可以加上—server,—username,—password等配置参数连接。--help可以显示帮助

    image

    1.2 vifs命令行参数

     vifs [<connection_options>]
       [--copy <source> <target> |
        --dir <remote_dir> |
        --help |
        --force |
        --get <remote_path> <local_path> |
        --listdc |
        --listds [--dc <datacenter>] |
        --mkdir <remote_dir> |
        --move <source> <target> |
        --put <local_path> <remote_path> |
        --rm <remote_path> |
        --rmdir <remote_dir> ]

    DESCRIPTION

    The vifs command performs common operations such as copy, remove, get, and put on files and directories. The command is supported against ESX/ESXi hosts but not against vCenter Server systems.

    Note: While there are some similarities between vifs and DOS or Unix file system management utilities, there are also many differences. For example, vifs does not support wildcard characters or current directories and, as a result, relative path names. Use vifs only as documented.

    1.3示例用法:

    Upload a file to the remote datastore:

     vifs <connection_options> -p "tmp/backup/VM.pl"
        "[StorageName] VM/VM.txt" -Z "ha-datacenter"

    2.列出所有的datastore和数据中心

    image

    如果有多个数据中心,操作datastore的时候需要加上—dc(-Z)参数附加上数据中心的名字。

    3.上传/删除文件到datastore

    3.1删除文件示例

    -Z参数此处可以忽略如果是单机,没有过个数据中心的话。

    image

    3.2下载文件到本机

    注意文件名要大小写区分。该脚本使用web方式HTTP GET得到文件。

    image

    3.3从本机上传文件

    image

    注意:此方法是用web方式的HTTP PUT,而且只能上传并覆盖host已经存在的文件,不能上传新文件。

    报错的例子:

    image

    4.查看文件系统volume

    storage filesystem list
    List the volumes available to the host. This includes VMFS, NAS and VFAT partitions.

    --help | -h
    Show the help message.

    image

    列出快照

    image

  • 相关阅读:
    JSON 数字排序 多字段排序
    hdu-4747-Mex
    Android SDK更新缓慢或无法更新的解决方法
    UVA 11806
    SDL显示内存中的图像
    Cocos2d-x 2.1.5 简单动画
    codeforce343A
    android 控件的移动
    Erlang千万级用户游戏框架(Openpoker)源码文件分析清单
    八大排序c++可运行精简版,一目了然
  • 原文地址:https://www.cnblogs.com/jjkv3/p/3465462.html
Copyright © 2011-2022 走看看