Wednesday, October 5, 2011

Using vifs to manipulate files on remote ESX/ESXi hosts

nUsing vifs to Manipulate Files on Remote ESX/ESXi Hosts
The vifs command performs common operations such as copy, remove, get, and put on ESX/ESXi files and directories. The command is supported against ESX/ESXi hosts but not against vCenter Server systems. Some similarities between vifs and DOS or UNIX/Linux file system management utilities exist, but there are many differences. For example, vifs does not support wildcard characters or current directories and, as a result, relative pathnames. Use vifs only as documented.

The vifs command supports different operations for the following groups of files and directories. Different operations are available for each group, and you specify locations with a different syntax.
Host. Host configuration files. You must specify the file’s unique name identifier. Specify host locations using the host/<path> syntax.
Temp. The /tmp directory and files in that directory. Specify temp locations using the tmp/dir/subdir syntax.
Datastores. Datastore files and directories. You have two choices for specifying a datastore: Datastore prefix style: '[ds_name] relative_path'. For example:
'[myStorage1] testvms/VM1/VM1.vmx'(Linux) or "[myStorage1] testvms/VM1/VM1.vmx" (Windows)
URL style: /folder/dir/subdir/file?dsName=<name>. For example:
'/folder/testvms/VM1/VM1.vmx?dsName=myStorage1' (Linux)
"/folder/testvms/VM1/VM1.vmx?dsName=myStorage1" (Windows)
The two example paths refer to a virtual machine configuration file for the virtual machine VM1 in the testvms/VM1 directory of the myStorage1 datastore.

Commands and description
--copy | -c  <source>   <target>
Copies a file in a datastore to another location in a datastore. The <source> must be a remote source path, the <target> a remote target path or directory.
The --force option replaces existing destination files.
--dir | -D  <remote_dir>
Lists the contents of a datastore directory
--force | -F
Overwrites the destination file. Used with --move and --copy.
--get | -g  <remote_path>  <local_path>
Downloads a file from the ESX/ESXi host to the machine on which you run vCLI. This operation uses HTTP GET.
--listdc | -C
Lists the datacenter paths available on an ESX/ESXi system.
--listds | -S
Lists the datastore names on the ESX/ESXi system. When multiple data centers are available, use the --dc (-Z) argument to specify the name of the datacenter from which you want to list the datastore.
--mkdir | -M  <remote_dir>
Creates a directory in a datastore. This operation fails if the parent directory of dst_datastore_file_path does not exist.
--move | -m  <source> <target>
Moves a file in a datastore to another location in a datastore. The <source> must be a remote source path, the <target> a remote target path or directory. The --force option replaces existing destination files.
--put | -p  <local_path>  <remote_path>
Uploads a file from the machine on which you run vCLI to the ESX/ESXi host. This operation uses HTTP PUT. This command can replace existing host files but cannot create new files.
--rm | -r  <remote_path>
Deletes a datastore file.
--rmdir | -R  <remote_dir>
Deletes a datastore directory. This operation fails if the directory is not empty.



No comments: