Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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
List
List
Anchor
ManageVirtualDisks-List
ManageVirtualDisks-List
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:

...

Code Block
languagebash
linenumbersfalse
vss-cli compute vm get vm-1233 disk 1 scsi

bus_number          : 0
label               : SCSI controller 0
type                : VirtualLsiLogicController

Anchor
Update
Update
Anchor
ManageVirtualDisks-Update
ManageVirtualDisks-Update
Update

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:

Code Block
languagebash
linenumbersfalse
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
Expand
Expand
Anchor
ManageVirtualDisks-Expand
ManageVirtualDisks-Expand
Expand

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:

Code Block
languagebash
linenumbersfalse
vss-cli compute vm set vm-1234 disk up 1 --capacity 50

Anchor
Controller
Controller
Anchor
ManageVirtualDisks-Controller
ManageVirtualDisks-Controller
Controller

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:

...

Name

Description

sharingmultiwriter

The virtual disk is shared between multiple virtual machines.

sharingnone

The virtual disk is not shared.

Anchor
Create
Create
Anchor
ManageVirtualDisks-Create
ManageVirtualDisks-Create
Create

Creating 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
Copy
Copy
Anchor
ManageVirtualDisks-Copy
ManageVirtualDisks-Copy
Copy

Similar 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
Remove
Remove
Anchor
ManageVirtualDisks-Remove
ManageVirtualDisks-Remove
Remove

Disk 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.

...