vCLI: Managing Files


As I want to get deeper into VMware CLI (vCLI) I deciced to make a summary of the vSphere Command-Line Interface Installation and Scripting Guide. Every chapter will be a separate blog post.
This summary is meant for my documentation but feel free to make use of it.

In this blog post: Managing Files

VMFS file systems
/vmfs/volumes/[filesystem-UUID]
/vmfs/volumes/[filesystem-label]

VMFS file
/vmfs/volumes/[filesystem-label or filesystem-UUID]/[dir]/disk.vmdk

Syntax: vmkfstools [connection options] [options] [target]
connection options: See Running vCLI Commands

File system options
–blocksize (-b) [1m, 2m, 4m, 8m]
Specify the blocksize. Used with –createfs
–createfs (-C) vmfs3
Create a VMFS file system
–queryfs (-p)
List attributes of a file system
–setfsname (-S) [label]
Sets the label of the file system. Used with –createfs
–spanfs (-Z)
Extends the VMFS file system

Virtual Disk options
–adaptertype (-a) [buslogic,lsilogic,ide]
Specify adapter type. Used with –createvirtualdisk and –clonevirtualdisk
–clonevirtualdisk [source] [destination]
clones the virtual disk
–createrdm (-r) [device] [rdm_file]
Maps a raw disk to a file on a VMFS file system
–createrdmpassthru (-z)
Map a passthrough raw disk to a file on a VMFS file system
–createvirtualdisk (-c) [size kK,mM,gG]
Create a virtual disk
–deletevirtualdisk (-U)
Deletes a virtual disk
–diskformat (-d) [zeroedthick(default), eagerzeroedthick, thin, rdm, rdmp, 2gbparse]
Specify virtual disk format
–extendvirtualdisk (-x)
Extends the virtual disk
–geometry (-g)
Display the virtual disk geomerty in C/H/S (Cylinders, Heads and Sectors)
–inflatedisk (-j)
converts a thin virtual disk to eagerzeroedthick format
–renamevirtualdisk (-E)
renames the virtual disk
–writezeros (-w)
Cleans the virtual disk by writing zeros over all its data

Manipulate files on remote ESX/ESXi host using vifs (not vCenter)
Groups:
Host
The hostname. syntax: host/[path]
Temp
The temp directory of the host. Syntax: tm/dir/subdir
Datastore
The datatstore name. Syntax: ‘[datastorename]/vm1/vm1.vmx’

Options
–copy (-c) [source] [target] –force
Copy files between datastores. –force is optional
–dir (-D) [remote dir]
List content
–force (-F)
Overwrite files
–get (-g) [remote path] [local path]
Download file from ESX/ESXI to machine where vCLI is running
–listdc (-S)
List datastore names
–mkdir (-M) [remote dir]
Create directory on remote dir
–move (-m) [source] [target] –force
Move files between or on datastores. –force option is optional
–put (-p) [local path] [remote path]
Upload files from machine where vCLI is running to a datastore
–rm (-r) [remote path]
Delete a file on a datastore
–rmdir (-R) [remote dir]
Deletes a directory on a datastore

About Michael
Michael Wilmsen is a experienced VMware Architect with more than 20 years in the IT industry. Main focus is VMware vSphere, Horizon View and Hyper Converged with a deep interest into performance and architecture. Michael is VCDX 210 certified, has been rewarded with the vExpert title from 2011, Nutanix Tech Champion and a Nutanix Platform Professional.

RSS feed for comments on this post.

Leave a Reply

You must be logged in to post a comment.