Add New Disk

To add a new disk, use the following request:

POST /virtual_machines/:virtual_machine_id/disks.xml
POST /virtual_machines/:virtual_machine_id/disks.json

XML Request Example

curl -i -X POST http://onapp.test/virtual_machines/458/disks.xml -d '<disk><primary>0</primary><disk_size>5</disk_size><file_system>ext4</file_system><data_store_id>5</data_store_id><mount_point>true</mount_point><hot_attach>1</hot_attach><min_iops>600</min_iops><is_swap>true</is_swap><require_format_disk>1</require_format_disk><mounted>true</mounted></disk>' -u user:userpass -H 'Accept: application/xml' -H 'Content-type: application/xml'

JSON Request Example

curl -i -X POST http://onapp.test/virtual_machines/458/disks.json -d '{"disk":{"primary":"0","disk_size":"2","file_system":"ext4","data_store_id":"5","label":"qwerq", "require_format_disk":"1","mount_point":"/mnt/aaa","hot_attach":"1","min_iops":"600","mounted":"true"}}' -u user:userpass -H 'Accept: application/json' -H 'Content-type: application/json'

Where:

data_store_id* - the ID of a data store where this disk is located

label - the disk label

primary - set 1 if the disk is primary, otherwise, set 0

disk_size* - the disk space in GB

Please note that support of secondary disks larger than 2 TB is limited. Certain operations might fail. This will be improved in future releases.

  • If you add a disk larger than 2 TB, you will not be able to mount or create a backup of such disk via OnApp Control Panel. These operations may be performed only manually inside a virtual server. Also, resize will not be possible for such disks.
  • You can perform the following operations with a secondary disk that is larger than 2 TB:
    • Migrate 
    • Delete / Wipe 
    • Edit IO limits
    • Rebalance (for VSs with Integrated Storage feature enabled)
  • OnApp provides a RAW device available inside a VS that you may use. For example, you may create a GPT partition and format it using any available file system which can be mounted inside VS.

is_swap - set true if this is a swap disk, otherwise, set false

mount_point - a physical location in the partition used as a root filesystem

hot_attach - set 1 to enable hot attachment, otherwise, set 0. In this case, a virtual server is not stopped when a disk is added.

To run hot attach, a virtual server template should support VirtIO virtualization. The hot attach option is available only on KVM compute resources based on CentOS 6.x/7.x for virtual servers with VirtIO support.

min_iops - the minimum number of IO operations per second (this is a SolidFire related parameter)

add_to_linux_fstab - set true to add the disk to your Linux fstab file, otherwise, set false

add_to_freebsd_fstab - set true to add the disk to your FreeBSD fstab file, otherwise, set false

mounted - set true to mount the disk inside OS automatically, otherwise, set false

You can use a single mounted parameter to substitute the two add_to_linux_fstab and add_to_freebsd_fstab parameters.

require_format_disk - set 1 to format disk, otherwise, set 0

file_system - for Linux-based virtual servers, you can specify the ext4 or xfs file system instead of the ext3 default one. For Windows-based virtual servers, you cannot specify a file system other than ntfsTo set the file_system parameter, you must set the require_format_disk option.