Last active
August 30, 2017 09:23
-
-
Save wolfoo2931/4373e33adbc7505263a014670e6dea75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
no semicolon after the do :)
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
For volume
for disk in
bosh disks --orphaned | grep 'vol-' | cut -d ' ' -f 2
; do bosh delete disk $disk ; done; echo "end"