Skip to content

Instantly share code, notes, and snippets.

@JohnPreston
Created January 16, 2017 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnPreston/aa6f08e67c0ca989a978cc01e885ad82 to your computer and use it in GitHub Desktop.
Save JohnPreston/aa6f08e67c0ca989a978cc01e885ad82 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
vdisplay | grep Path | grep LV | awk '{print $NF}' | xargs -i -P 1 lvremove -f {}
vgdisplay | grep Name | awk '{print $NF}' | xargs -i -P 1 vgremove -f {}
pvdisplay | grep Name | grep PV | awk '{print $NF}' | xargs -i -P 1 pvremove -f {}
fdisk -l | grep xvd | grep -v xvd[a-i] | grep -v Disk | awk '{print $1}' | sed 's/[0-9]//g' | xargs -i -P1 parted -s {} rm 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment