[Home] [Forum] [3i RCLI Guide]

The command vifs.php can be used to move files to and from your ESXi host. As of Update 2 of the ESXi 3.5 RCLI, this command is not supported with VirtualCenter. If you only need to copy files from your ESXi host, then you can also use your web browser to retrieve files. ESXi allows for two URLs to access files from your host.

https://<ESXi_ip/hostname>/folder - this URL can be used to browse the datastores that the ESXi has access to.
https://<ESXi_ip/hostname>/host - this URL is used to access host configuration and log files. Access to host files is controlled by the file /etc/vmware/hostd/webAccessibleConfigFiles.xml. Direct editing of this file would not be supported, but it would be possible to replace this file by customizing oem.tgz to expose more system files for editing. The below chart summarizes the host configuration / log files that are exposed by webAccessibleConfigFiles.xml and are thus downloadable via the web browser or accessible with vifs.pl

 
Display Name Host File Name Permissions with vifs.pl
hostAgentConfig.xml /etc/vmware/hostd/config.xml GET/HEAD/PUT
sfcb.cfg /etc/sfcb.cfg GET/HEAD/PUT
openwsman.conf /etc/operwsman/openwsman.conf GET/HEAD/PUT
license.cfg /etc/vmware/license.cfg GET/HEAD/PUT
vmware.lic /etc/vmware/vmware.lic GET/HEAD/PUT
vmware_config /etc/vmware/config GET/HEAD/PUT
vmware_configrules /etc/vmware/configrules GET/HEAD/PUT
proxy.xml /etc/vmware/hostd/proxy.xml GET/HEAD/PUT
snmp.xml /etc/vmware/snmp.xml GET/HEAD/PUT
syslog.conf /etc/syslog.conf GET/HEAD/PUT
ssl_cert /etc/vmware/ssl/rui.crt GET/HEAD/PUT
ssl_key /etc/vmware/ssl/rui.key PUT
hosts /etc/hosts GET/HEAD/PUT
motd /etc/motd GET/HEAD/PUT
vpxa.cfg /etc/opt/vmware/vpxa/vpxa.cfg GET/HEAD/PUT
esx.conf /etc/vmware/esx.conf GET/HEAD/PUT
config.log /var/log/config.log GET/HEAD
messages /var/log/messages GET/HEAD
ipmi_sel.raw /var/log/ipmi_sel.raw GET/HEAD
ipmi_sel /var/log/ipmi_sel GET/HEAD
hostd.log /var/log/vmware/hostd.log GET/HEAD
vpxa.log /var/log/vmware/vpxa/vpxa.log GET/HEAD

Note: while most systems will only have one IPMI node, a system could have up to four in which case the files ipmiX_sel.raw (/var/log/ipmi/X/sel.raw), ipmiX_sel (/var/olg/ipmi/X/sel), ipmiX_sdr_content.raw (/var/log/ipmi/X/sdr_content), ipmiX_sdr_header.raw (/var/log/ipmi/X/sdr_header.raw) and ipmiX_sensor_readings.raw (/var/log/ipmi/X/sensor_readings.raw) would be displayed where X would correspond with the node number (0 to 3). These files would have GET/HEAD permissions.

Vifs.pl can access three types of files and folders on your host.
Host - host configuration and log files as shown in the the list above. These are accessed with the path of /host/<filename>
Temp - files and folders located in the /tmp directory
Datastores - use the datastores options to access files and folders on your host's datastores. There are two syntax options for accessing datastore files.
1) Datastore prefix = [datastore_name] relative path - for the Linux RCLI it would be '[datastore1] folder/filename' and for Windows it would be "[datastore1] folder\filename"
2) URL style = /folder_path/filename=datastorename - for the Linux RCLI it would be '/folder/filename&dsName=datastore1' and for Windows it would be "/folder/filename&dsName=datastore1"

Note: should the directory name include a space, then the patch should be enclosed in quotes as show in the above examples.

The vifs.pl command allows for the options shown below.

Option

Works on
datastore / temp / host

Description
--copy (-c) <source> <destination>
X / X / --
Copy a file from one datastore location to another.
--force
X / X / --
Used with the copy option to overwrite the destination files
--dir (-D) <path>
X / X / --
Lists the contents of a datastore or temp folder
--get (-g) <remote_file> <local_file>
X / -- / X
Copy a datastore or ESX(i) host file to the host running the RCLI. This operation uses HTTP GET (see accessing files via a URL above).
--listdc (-C)
X / -- / X
Lists available datacenter paths on the host
--listds (-S)
X / -- / X
List the datastore names that a host has access to. If you are using multiple datacenters, then use the --dc (-Z) argument to specify the name of the datacenter from which to list the datastore
--dc (-Z) <datacenter_name>
X / -- / X
Not used with single-host operations, this option will specify the datacenter context
--put (-p) <local_file> <remote_file>
X / X / X
Copy a file from the RCLI host to the ESX(i) host using HTTP PUT
--move (-m) <source> <destination>
X / X / --
Move a file from one datastore to another
--rm (-r) <remote_file>
X / X / --
Delete a file on the ESX(i) host
--rmdir (-R) <remote_folder>
X / X / --
Delete a folder on the ESX(i) host
--mkdir (-M) <remote_folder>
X / X / --
Create a folder on the ESX(i) host

Sample Session

vifs.pl --server 192.168.1.40 --username root --dir "[datastore1] SAN01"
SAN01-flat.vmdk
SAN01.vmdk
XVS-flat.vmdk
XVS.vmdk
XVS.vmsd
XVS.vmx
XVS.vmxf

vifs.pl --server 192.168.1.40 --username root --dir [datastore1]SAN01
SAN01-flat.vmdk
SAN01.vmdk
XVS-flat.vmdk
XVS.vmdk
XVS.vmsd
XVS.vmx
XVS.vmxf

vifs.pl --server 192.168.1.40 --username root --copy /vmfs/volumes/datastore1/SAN01/XVS.vmx /vmfs/volumes/datastore1/SAN01/XVS_backup.vmx
Copied file from /vmfs/volumes/datastore1/SAN01/XVS.vmx to /vmfs/volumes/datastore1/SAN01/XVS_backup.vmx successfully.

vifs.pl --server 192.168.1.40 --username root --listdc
ha-datacenter

vifs.pl --server 192.168.1.40 --username root --listds
NFS1 (1)
datastore1

vifs.pl --server 192.168.1.40 --username root --get [datastore1]SAN01/XVS.vmx c:\tmp\XVS.vmx
Downloaded file SAN01/XVS.vmx to c:\tmp\XVS.vmx successfully.

vifs.pl --server 192.168.1.40 --username root --get [datastore1]SAN01/XVS.vmx c:\tmp\XVS.vmx --protocol http
Note: you can download via HTTP if you have enabled this. This has the potential to speed up copies by 10 to 15%

vifs.pl --server 192.168.1.40 --username root --put c:\tmp\XVS.vmx "[datastore1] SAN01/XVS2.vmx"
Uploaded file c:\tmp\XVS.vmx to SAN01/XVS2.vmx successfully.

vifs.pl --server 192.168.1.40 --username root --rm "[datastore1] SAN01/XVS2.vmx"
Remove 'SAN01/XVS2.vmx'? (y/n) : y
Deleted file [datastore1] SAN01/XVS2.vmx successfully.

The copying and moving of datastore files and folders can also be done with the VI client. Right click on the datastore and select "Browse Datastore". You can then use the highlighted icons to manage files and folders or you can right click to get these options.

INSERT YOUR COMMENT - IF YOU HAVE A QUESTION PLEASE USE THE FORUM


Name (required)

Web Site (optional)

Email address (required - will not be displayed)

Comment (required)

Please enter code

 

Copyright © 2011 - Dave Mishchenko