ansitest/VIRTBOX/vb-virtmedia-cleanup.sh
2021-08-19 22:32:50 -05:00

19 lines
460 B
Bash

#!/bin/bash
# cleanup inaccessible disks in VMM
vboxmanage list hdds > /tmp/vbox-hds-all.txt
vboxmanage list hdds |grep -B 2 'State: inaccessible' \
|egrep -v 'Parent|State|--' >/tmp/infile-vboxdel.txt
#zfs-SAS-T5-12*.vdi > /tmp/infile.txt
#set -x
while read line; do
delme=$(echo "$line" |awk '{print $2}')
echo "$delme" >> /tmp/vbox-hd-inacc-del.log
vboxmanage closemedium disk "$delme" --delete
done < /tmp/infile-vboxdel.txt
date;