Skip to content

Instantly share code, notes, and snippets.

@wolfoo2931
Last active August 30, 2017 09:23
Show Gist options
  • Save wolfoo2931/4373e33adbc7505263a014670e6dea75 to your computer and use it in GitHub Desktop.
Save wolfoo2931/4373e33adbc7505263a014670e6dea75 to your computer and use it in GitHub Desktop.
# This command deletes all orphaned disks in a BOSH director (see: bosh.io; cloudfoundry.org)
# It assumes that the BOSH CLI is installed and that a BOSH director is targeded and the CLI is authenticated
for disk in `bosh disks --orphaned | grep 'disk-' | cut -d ' ' -f 2`; do; bosh delete disk $disk; done
@iamNoah1
Copy link

no semicolon after the do :)

@lucaspinto
Copy link

This one requires jq, but is compatible with the BOSH CLI v2:

for disk in  `bosh disks --orphaned --json | jq -r '.Tables[].Rows[] .disk_cid'`; do bosh -n delete-disk $disk; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment