Get the disks and filesystems of a VPS
GET /api/v2/vps/{id}/storage
Returns the disks of a VPS with their size and use, the filesystems mounted inside it and the read and write totals. Each disk has gates that say whether it can be removed (canDetach), resized (canResize) or grown inside the VPS (canExpand). Use the disk id with POST /api/v2/vps/{id}/actions/resize-disk and DELETE /api/v2/vps/{id}/disks/{diskName}. Used space and filesystems come from the guest agent. While the VPS is stopped or has no guest agent, filesystems is empty and used space is 0. Sizes are in GB of 1024³ bytes. The VPS service must be active.
Authentication: An API key with the scopes read:vm and read:storage. About keys and scopes
Request
Path parameters
idstringrequiredvps_…).Example
curl "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/storage" \ -H "Authorization: Bearer $HOSTUP_API_KEY"Responses
200 The disks, filesystems and disk gates of the VPS.
{ "disks": [ { "id": "vpsdisk_01hxa3b4c5d6e7f8g9h0j1k2m3", "name": "scsi0", "type": "SCSI", "device": "/dev/scsi0", "guestDevice": "/dev/sda", "isCdrom": false, "bootOrder": 1, "capacity": { "totalGb": 80, "usedGb": 24.2, "freeGb": 55.8, "usagePercent": 30.25 }, "io": { "readGb": 120.5, "writeGb": 64.2, "readOperations": 102400, "writeOperations": 51200 }, "actions": { "canDetach": { "allowed": false, "reason": "Cannot detach root disk." }, "canResize": { "allowed": false, "reason": "To expand your main disk, use Billing -> Add Resources." }, "canExpand": { "allowed": true, "reason": null } } } ], "filesystems": [ { "mountpoint": "/", "type": "ext4", "name": "rootfs", "devices": [ "/dev/sda1" ], "capacity": { "totalGb": 78, "usedGb": 24.2, "freeGb": 53.8, "usagePercent": 31.03 } } ], "blockStats": { "totalReadGb": 120.5, "totalWriteGb": 64.2 }, "guestAgentAvailable": true, "vmNotRunning": false}Response fields
disksarray of objectidstring or nullvpsdisk_…). Use it as diskId to resize the disk.namestring or nullscsi0.typestring or nullSCSI.devicestring or nullguestDevice.guestDevicestring or null/dev/sdb. It can differ from the slot in name. A CD-ROM drive takes a slot but no disk letter. The disk on scsi2 is then often /dev/sdb. Read from the guest agent when the disk holds a mounted filesystem. Otherwise worked out from the order of the attached disks. Null for CD-ROM drives and when no Linux device name applies.isCdrombooleanbootOrdernumber or null1 is the main disk.capacityobjecttotalGbnumberusedGbnumberfreeGbnumberusagePercentnumberioobjectreadGbnumberwriteGbnumberreadOperationsnumberwriteOperationsnumberactionsobjectcanDetachobjectallowedbooleanreasonstring or nullcodestring or nullcanResizeobjectPOST /api/v2/vps/{id}/actions/resize-disk. On a VPS that is not a Cloud VPS, the main disk grows with the storageGb option on POST /api/v2/vps/{id}/actions/config instead.allowedbooleanreasonstring or nullcodestring or nullcanExpandobjectallowedbooleanreasonstring or nullcodestring or nullfilesystemsarray of objectmountpointstring or nulltypestring or nullnamestring or nulldevicesarray of stringcapacityobjecttotalGbnumberusedGbnumberfreeGbnumberusagePercentnumberblockStatsobjecttotalReadGbnumbertotalWriteGbnumberguestAgentAvailablebooleanvmNotRunningbooleanErrors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | Invalid request. The response body is an RFC 7807 Problem Details document. |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | Not found. The resource does not exist or is not owned by the caller; code is vps_not_found. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |