VDI Commands to Create, Delete, Update, Import & Export

VDI-Commands-actsupport

Diagnose your network configuration with the below discussed VDI commands. Make use of these VDI commands to troubleshoot your network configuration and check how to migrate a Xen VDI to another storage repository via the command line.

VDI commands to clone, create, delete, update, import & export

1.CREATE:

If you want to create a VDI with virtual size specified either in KiB, MiB, GiB, and TiB or in bytes using the below command:

vdi-create sr-uuid=uuid_of_sr_to_create_vdi_on name-label=name_for_the_vdi type=system|user|suspend|crashdump virtual-size=size_of_virtual_disk sm-config-\*=storage_specific_configuration_data 

2.CLONE

In case, if you wish to clone, you can create a writable new copy of the specified VDI and use it directly.

vdi-clone uuid=uuid_of_the_vdi 

You can use the driver:parms to pass extra vendor-specific configuration information to the back-end storage driver.

3.DELETE

To Delete, retain the changed block tracking metadata while, destroying the data associated with the specified VDI and use the command:

vdi-data-destroy uuid=uuid_of_vdi

If you want to destroy the specified VDI, then use:

vdi-destroy uuid=uuid_of_vdi

4.EXPORT & IMPORT

You can Export / Import VDI either in raw or vhd format to a specified file name. All the unallocated blocks within the VDI will be omitted to make your VHD file smaller to transfer.

Command to Export:

vdi-export uuid=uuid_of_vdi filename=filename_to_export_to [format=format] [base=uuid_of_base_vdi] [--progress] 

Using base parameter, only the blocks that have changed between the exported VDI and the base VDI will be exported.

Command to Import:

vdi-import uuid=uuid_of_vdi filename=filename_to_import_from [format=format] [--progress]

5.RESIZE

You can resize or change the size of the VDI specified by UUID by using the command:

vdi-resize uuid=vdi_uuid disk-size=new_size_for_disk

Migrate Xen VDI

To Migrate a Xen VDI to another storage repository via command line, then you can follow the below-given steps:

Run xe vm-disk-list vm=$VM , which will display both disks and the storage repositories where these disks are stored in.

You can get these details from sr-name-label

If you want to get a complete list of storage repositories, then run xe sr-list.

By running xe sr-param-list uuid=$SRUUID you can view whether the storage is full or not.

You can migrate VDI that is full to another storage repository using the command:

xe vdi-pool-migrate uuid=$VDI sr-uuid=$NEWSRUUID
#prints NEWVDI uuid

Note: Make sure that your VM is running, while you run the above command.

Now you can check whether VDI has been successfully moved or not using the command,

xe vm-disk-list

Hope you found it useful. For any assistance feel free to Contact Us, our experts are ready to assist you.

Check our previous post: Troubleshoot the most common ESXi Booting Issues Now!

Follow us for the latest updates on Facebook, Twitter, LinkedIn

Subscribe to get free blog content to your Inbox
Loading

Written by actsupp-r0cks