Manage Virtual Disks
Virtual machine disks are listed by vss-cli compute vm get <name-or-vm-id> disk <unit> and updated, removed and created by vss-cli compute vm set <name-or-vm-id> disk <unit>. This tutorial walks you through the process of managing virtual machine disks.
List
To list a summary of current virtual machine disks, use vss-cli compute vm get <name-or-vm-id> disk or vss-cli compute vm get <name-or-vm-id> disk <unit> to get specific information of a disk unit. For instance, the following virtual machine has two virtual disks configured:
vss-cli compute vm get VMName disk
label unit controller.virtual_device_node
----------- ------ --------------------------------
Hard disk 1 1 SCSI controller 0:0
Hard disk 2 2 SCSI controller 1:1
Hard disk 3 3 SCSI controller 1:0Getting specific information of a given disk unit, run vss-cli compute vm get <name-or-vm-id> disk <unit> as follows:
vss-cli compute vm get vm-1233 disk 1
label : Hard disk 1
unit : 1
virtual_device_node : SCSI controller 0:0
capacity_gb : 8
shares.level : normalGetting backing information of a particular disk is available by including the sub-command backing in the disk command:
vss-cli compute vm get vm-1233 disk 1 backing
descriptor_file_name: None
device_name : None
disk_mode : persistent
file_name : [CL-NSTOR47-NFS-vol33] 1806P-modest_davinci_66/1806P-modest_davinci_66.vmdk
lun_uuid : None
thin_provisioned : TrueGetting details of the SCSI controller of a particular disk is available by including the sub-command scsi in the disk command:
vss-cli compute vm get vm-1233 disk 1 scsi
bus_number : 0
label : SCSI controller 0
type : VirtualLsiLogicControllerUpdate
There are three allowed actions to modify a given disk unit: remove, update and create as shown by vss-cli compute vm set <name-or-vm-id> disk mk|up|rm --help command:
Usage: vss-cli compute vm set disk [OPTIONS] COMMAND [ARGS]...
Manage virtual machine disks. Add, expand and remove virtual disks.
Options:
--help Show this message and exit.
Commands:
mk Create new disk
rm Remove disk from vm
up Update disk capacity and controllerExpand
In order to expand an existing disk, use vss-cli compute vm set <name-or-vm-id> disk up <unit> -c <capacityGB> as shown below:
vss-cli compute vm set vm-1234 disk up 1 --capacity 50Controller
SCSI controllers are also available to update via the CLI. Use vss-cli compute vm set <name-or-vm-id> disk up <unit> -s <bus_number> as follows:
vss-cli compute vm set vm-1234 disk up 1 --scsi 1Backing Mode
Disk backing modes can be updated via vss-cli compute vm set <name-or-vm-id> disk up <unit> -m <disk-mode>:
vss-cli compute vm set vm-1234 disk up 1 --backing-mode independent_persistentRefer to the following table to pick the right backing mode:
Name | Description |
|---|---|
append | Changes are appended to the redo log; you revoke changes by removing the undo log. |
independent_nonpersistent | Same as nonpersistent, but not affected by snapshots. |
independent_persistent | Same as persistent, but not affected by snapshots. |
nonpersistent | Changes to virtual disk are made to a redo log and discarded at power off. |
persistent | Changes are immediately and permanently written to the virtual disk. |
undoable | Changes are made to a redo log, but you are given the option to commit or undo. |
Backing Sharing Mode
Disk backing sharing modes can be updated via vss-cli compute vm set <name-or-vm-id> disk up <unit> -r <sharing>:
Refer to the following table to pick the right backing sharing:
Name | Description |
|---|---|
sharingmultiwriter | The virtual disk is shared between multiple virtual machines. |
sharingnone | The virtual disk is not shared. |
Create
Creating a new virtual machine disk is as simple as updating, but switching the sub-command to mk, for example:
vss-cli compute vm set vm-1233 disk mk --disk 20Also, it supports providing both backing_mode and backing_sharing in the following format <capacity_gb>=<backing_mode>=<backing_sharing>=<backing_vmdk>. If no backing_mode and backing_sharing and backing_vmdk are provided, defaults are:
backing_mode:persistentbacking_sharing:sharingnonebacking_vmdk: automatically generated by vSphere. (advanced)
For instance:
vss-cli compute vm set vm-1233 disk mk --disk 100 --disk 100=independent_persistentOr in particular use cases, there could be a need for a sharingmultiwriter sharing mode:
vss-cli compute vm set vm-1233 disk mk --disk 100=persistent=sharingmultiwriterThe --disk payload can also be provided in JSON format:
vss-cli compute vm set vm-1233 disk mk –disk 100 –disk ‘{“capacity_gb”: 100, “backing_mode”: “independent_persistent”}’
Specify SCSI controller
By default, the ITS Private Cloud API creates disks using the first SCSI controller and available slots in it. If a SCSI controller is full, a new controller will be created using our pre-defined settings based on operating systems.
University of Toronto - Since 1827