Delete Orphaned Disks

Orphaned Disks are logical volume groups that are not used by Virtualizor. Use the Delete Orphaned Disks API to delete the orphaned disks present on your server. The API response will contain “done” as “success” on successful removal of the orphaned disks.

HTTP Request

https://hostname:4085/index.php?act=orphaneddisks

Parameters

NameMethodValueDescriptionRequired
actGETorphaneddisksThe action specified to list the orphaned disksYes
deletePOSTtextThe disk path of the orphaned disk. For deleting multiple orphaned disks pass in the disk paths as comma separated valuesYes

Sample Code

<?php

    require_once('/usr/local/virtualizor/sdk/admin.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['delete'] = '/dev/vg/orphan10';
    $post['delete'] = '/dev/vg/orphan11, /dev/vg/orphan12'; // for deleting multiple orphaned disks

    $output = $admin->orphaneddisks($post);

    print_r(json_encode($output));

?>

Output

{
    "title": "Orphaned Disks",
    "done": "success",
    "orphaned_disks": {
        "/dev/vg/orphan2": {
            "path": "/dev/vg/orphan2",
            "size": 1073741824,
            "st_id": 3
        },
        "/dev/vg/orphan6": {
            "path": "/dev/vg/orphan6",
            "size": 4194304,
            "st_id": 3
        },
        "/dev/vg/orphan7": {
            "path": "/dev/vg/orphan7",
            "size": 4194304,
            "st_id": 3
        },
        "/dev/vg/orphan8": {
            "path": "/dev/vg/orphan8",
            "size": 4194304,
            "st_id": 3
        },
        "/dev/vg/orphan9": {
            "path": "/dev/vg/orphan9",
            "size": 4194304,
            "st_id": 3
        }
    },
    "timenow": 1535630469,
    "time_taken": "0.647"
}
Was this helpful to you?