Last active
August 29, 2015 14:02
-
-
Save feczo/e55de9fba42d7ff00f3d to your computer and use it in GitHub Desktop.
unmounted disks on compute engine GCE using gcutil
This file contains hidden or 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
#!/usr/bin/env python | |
import os | |
os.system("gcutil listinstances --filter='status eq RUNNING' --columns=disks --format=csv 2>&1 | grep '/' >/tmp/gcutil.mounted;" | |
"gcutil listdisks --columns=name --format=names >/tmp/gcutil.disks") | |
disks = set(open("/tmp/gcutil.disks").read().split()) | |
mounted = set(open("/tmp/gcutil.mounted").read().split()) | |
uniques = disks.difference(mounted).union(mounted.difference(disks)) | |
print "UnMounted disk:" | |
for disk in uniques: | |
print disk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment