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.
Anchor |
---|
| ManageVirtualDisks-List |
---|
| ManageVirtualDisks-List |
---|
|
ListTo 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:
...
Code Block |
---|
language | bash |
---|
linenumbers | false |
---|
|
vss-cli compute vm get vm-1233 disk 1 scsi
bus_number : 0
label : SCSI controller 0
type : VirtualLsiLogicController |
Anchor |
---|
| ManageVirtualDisks-Update |
---|
| ManageVirtualDisks-Update |
---|
|
UpdateThere 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:
Code Block |
---|
language | bash |
---|
linenumbers | false |
---|
|
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 controller |
Anchor |
---|
| ManageVirtualDisks-Expand |
---|
| ManageVirtualDisks-Expand |
---|
|
ExpandIn order to expand an existing disk, use vss-cli compute vm set <name-or-vm-id> disk up <unit> -c <capacityGB>
as shown below:
Code Block |
---|
language | bash |
---|
linenumbers | false |
---|
|
vss-cli compute vm set vm-1234 disk up 1 --capacity 50 |
Anchor |
---|
| ManageVirtualDisks-Controller |
---|
| ManageVirtualDisks-Controller |
---|
|
ControllerSCSI 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:
...
Name | Description |
---|
sharingmultiwriter | The virtual disk is shared between multiple virtual machines. |
sharingnone | The virtual disk is not shared. |
Anchor |
---|
| ManageVirtualDisks-Create |
---|
| ManageVirtualDisks-Create |
---|
|
CreateCreating a new virtual machine disk is as simple as updating, but switching the sub-command to mk
, for example:
...
The --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.
...
Info |
---|
The task will first transfer the original VMDK, validate, inflate and convert the file to the right vSphere format. |
Anchor |
---|
| ManageVirtualDisks-Copy |
---|
| ManageVirtualDisks-Copy |
---|
|
CopySimilar to importing a VMDK
, copying virtual disks across virtual machines allows the flexibility to duplicate a disk from one VM to another with a simple command.
...
Info |
---|
VMDK Copy tasks might take a while based on the source VM size and how much resources are available.
|
Anchor |
---|
| ManageVirtualDisks-Remove |
---|
| ManageVirtualDisks-Remove |
---|
|
RemoveDisk removal will ask for confirmation if flag -r/--rm
is not provided. This is just as fail safe for mistakes that can happen and since disk removal is a one way action, it may end in data loss if not used carefully.
...